home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / basic / altqb550.zip / DEMON.BAS < prev    next >
BASIC Source File  |  1992-10-18  |  89KB  |  2,195 lines

  1. ' DEMON.BAS     this program illustrates some of the ways that the routines
  2. '               provided in the Libraries in this package, can enhance your
  3. '               Extended QuickBASIC programs.
  4. '
  5. '   Author:     Christy Gemmell
  6. '   For:        Assembly-Language Toolbox for QuickBASIC
  7. '   Version:    5.50
  8. '   Date:       11/10/1992
  9. '
  10. '   For MicroSoft QuickBASIC and BASIC 7 Professional Development System.
  11. '   Assembler routines created with MicroSoft Macro Assembler MASM 6.0
  12. '
  13. '   Compile:    BC /E/Fs/O/S/X demon;
  14. '   Link:       Link /E/F demon,,,altquick.lib;
  15. '
  16. '   $DYNAMIC                             ' required for stringsort routine
  17. '
  18. '┌────────────────────────────────────────────────────────────────────────┐
  19. '│      External Functions and Procedures.                                │
  20. '└────────────────────────────────────────────────────────────────────────┘
  21. '
  22. '   The following prototypes refer to assembly-language procedures which
  23. '   are in the library files TOOLBOX.LIB and TOOLBOX.QLB. One or other of
  24. '   these libraries must be linked to the program which calls them.
  25. '
  26.     DECLARE FUNCTION Attribute% (BYVAL Fore%, BYVAL Back%)
  27.     DECLARE FUNCTION CapsLock% (BYVAL Switch%)
  28.     DECLARE FUNCTION Cpu% ()
  29.     DECLARE FUNCTION EmsError% ()
  30.     DECLARE FUNCTION EmsFrame% ()
  31.     DECLARE FUNCTION EmsOwned% (BYVAL Handle%)
  32.     DECLARE FUNCTION EmsPages% (BYVAL Switch%)
  33.     DECLARE FUNCTION EmsPresent% ()
  34.     DECLARE FUNCTION EmsVersion% ()
  35.     DECLARE FUNCTION FarPeek% (BYVAL Segment&, BYVAL OffSet&)
  36.     DECLARE FUNCTION FreeSpace& (BYVAL DriveNo%)
  37.     DECLARE FUNCTION KeyFlags% ()
  38.     DECLARE FUNCTION KeyIn% ()
  39.     DECLARE FUNCTION KeyStat% ()
  40.     DECLARE FUNCTION MathsChip% ()
  41.     DECLARE FUNCTION MouseInit% ()
  42.     DECLARE FUNCTION NumLock% (BYVAL Switch%)
  43.     DECLARE FUNCTION PeekWord& (BYVAL Segment&, BYVAL OffSet&)
  44.     DECLARE FUNCTION PrinTest% (BYVAL Printer%)
  45.     DECLARE FUNCTION Rand% (BYVAL Lower%, BYVAL Higher%)
  46.     DECLARE FUNCTION ScrLock% (BYVAL Switch%)
  47.     DECLARE FUNCTION FileSize& (FileSpec$)
  48.     DECLARE FUNCTION StatusLine% (Message$)
  49.     DECLARE FUNCTION StringScan% (Trgt$, BYVAL Size%, BYVAL Strt%, BYVAL Addr%)
  50.     DECLARE FUNCTION Verify% (BYVAL Default%, BYVAL Row%, Prompt$,_
  51.                               BYVAL Attr%, BYVAL Mouse%)
  52.     DECLARE SUB BackFill (BYVAL Row%, BYVAL Col%, BYVAL Rows%, BYVAL Cols%,_
  53.                           BYVAL Attr%)
  54.     DECLARE SUB Cipher (Text$, KeyWord$)
  55.     DECLARE SUB ClearEnd (BYVAL Switch%, BYVAL Attr%)
  56.     DECLARE SUB Curtains (BYVAL Speed%, BYVAL Attr%)
  57.     DECLARE SUB DOSBox (BYVAL Switch%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  58.                         BYVAL X2%, BYVAL Attr%)
  59.     DECLARE SUB EmsGet (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%,_
  60.                         BYVAL Page%, BYVAL Handle%, Done%)
  61.     DECLARE SUB EmsPut (BYVAL Segment%, BYVAL OffSet%, BYVAL Length%,_
  62.                         BYVAL Page%, BYVAL Handle%, Done%)
  63.     DECLARE SUB EmsRelease (BYVAL Handle%)
  64.     DECLARE SUB EmsRequest (BYVAL Pages%, Handle%)
  65.     DECLARE SUB FastPrint (BYVAL Row%, BYVAL Col%, Message$, BYVAL Attr%)
  66.     DECLARE SUB GraPrint (BYVAL xLoc%, BYVAL yLoc%, Text$, BYVAL Attr%,_
  67.                           BYVAL Scale%)
  68.     DECLARE SUB HelpMate (BYVAL Colour%, Title$, BYVAL Context%, Topic$)
  69.     DECLARE SUB KeyFlush ()
  70.     DECLARE SUB MisTake (BYVAL Row%, Message$, BYVAL Attr%, BYVAL Mouse%)
  71.     DECLARE SUB MouseHide ()
  72.     DECLARE SUB MouseNow (LeftButton%, RightButton%, xMouse%, yMouse%)
  73.     DECLARE SUB MouseShow ()
  74.     DECLARE SUB Pause (BYVAL Ticks%)
  75.     DECLARE SUB PerCentBox (BYVAL Switch%, Message$, BYVAL Attr%,_
  76.                             BYVAL PerCent%)
  77.     DECLARE SUB PopUp (BYVAL Row%, BYVAL Col%, BYVAL Hght%, BYVAL Wdth%,_
  78.                        BYVAL Attr%, BYVAL Brdr%, BYVAL Shdw%, BYVAL Zoom%)
  79.     DECLARE SUB PrintSet (BYVAL Row%, BYVAL Col%, BYVAL Attr%,_
  80.                           BYVAL Printer%, BYVAL Mouse%)
  81.     DECLARE SUB ReSeed (BYVAL Seed&)
  82.     DECLARE SUB Scroll (BYVAL Dir%, BYVAL Y1%, BYVAL X1%, BYVAL Y2%,_
  83.                         BYVAL X2%, BYVAL Units%, BYVAL Attr%)
  84.     DECLARE SUB ShutUp (BYVAL Speed%)
  85.     DECLARE SUB StringSort (BYVAL Dir%, BYVAL Size%, BYVAL Addr%)
  86.     DECLARE SUB VGALoad (File$)
  87.     DECLARE SUB VGAPan (BYVAL X%, BYVAL Y%)
  88.     DECLARE SUB VGASave (File$)
  89.  
  90. '   These are native QuickBASIC procedures which are in MIXED.LIB/QLB
  91. '
  92.     DECLARE FUNCTION BinDec& (Binary$)
  93.     DECLARE FUNCTION BitTest% (Number%, Bit%)
  94.     DECLARE FUNCTION DateInput$ (Default$, Context%, Topic$, HotKey%)
  95.     DECLARE FUNCTION DosVersion$ ()
  96.     DECLARE FUNCTION FindFile$ (FileSpec$, Attr%, Mouse%)
  97.     DECLARE FUNCTION GetFlag% (Flag%)
  98.     DECLARE FUNCTION GrAttrib% (ForeGround%, BackGround%)
  99.     DECLARE FUNCTION IsDir% (Test$)
  100.     DECLARE FUNCTION LongDate$ (Day%, Month%, Year%)
  101.     DECLARE FUNCTION RevInput$ (Max%, Visible%, Default$, Legal$, Ctx%,_
  102.                                 Topic$, Mask%, HotKey%)
  103.     DECLARE SUB BarMenu (P1%, P2%, P3%, Menu$(), P5%, P6%, P7%,_
  104.                          P8$, Mouse%, HotKeys%)
  105.     DECLARE SUB CheckPrinter (Printer%)
  106.     DECLARE SUB Panel (Row%, Col%, Rows%, Cols%, Border%, Attr%)
  107.     DECLARE SUB SetFlag (Flag%, Setting%)
  108.     DECLARE SUB SortFile (PathName$, OffSet%, FieldLen%, RecordLen%, Done%)
  109.     DECLARE SUB VerMenu (P1%, P2%, P3%, P4%, P5%, P6$, Menu$(), P8%, P9%,_
  110.                          P10%, P11%, P12$, Mouse%, HotKeys%)
  111.     DECLARE SUB VideoMode (Colour%, MaxRes%, VideoRam%)
  112.  
  113. '   Local, program-specific, functions and procedures.
  114. '
  115.     DECLARE SUB Frame (Title$, Switch%)
  116.  
  117. '┌────────────────────────────────────────────────────────────────────────┐
  118. '│      Initialisation.                                                   │
  119. '└────────────────────────────────────────────────────────────────────────┘
  120. '
  121.     CONST FALSE = 0, TRUE = NOT FALSE
  122.  
  123. '   Allow plenty of stack space for function and procedure calls.
  124. '
  125.     CLEAR , , &H2000
  126.  
  127. '   Establish error trapping and point to error handler.
  128. '
  129.     ON ERROR GOTO Trap
  130.  
  131. '   Check video capabilities of the host system (default to MDA).
  132. '
  133.     Colour% = FALSE                             ' Default to monochrome
  134.     MaxRes% = 0                                 ' Default to text only
  135.     VideoRam% = 4                               ' Default to 4K buffer
  136.  
  137.     VideoMode Colour%, MaxRes%, VideoRam%       ' Find what's installed
  138.  
  139. '   Set display colours for colour and monochrome displays.
  140. '
  141.     IF Colour% THEN
  142.        BarColour% = 48                          ' Black on Cyan
  143.        HeadColour% = 31                         ' Bright White on Blue
  144.        StatColour% = 48                         ' Black on Cyan
  145.        TextColour% = 112                        ' Black on White
  146.     ELSE
  147.        BarColour% = 112                         ' Reverse video
  148.        HeadColour% = 15                         ' Intense White on Black
  149.        StatColour% = 112                        ' Reverse video
  150.        TextColour% = 7                          ' White on Black
  151.     END IF
  152.  
  153. '   Check the type of display adaptor installed.
  154. '
  155.     SELECT CASE MaxRes%
  156.         CASE 13
  157.              IF VideoRam% = 64 THEN
  158.                 Adaptor$ = "Multi-Colour Graphics Array"
  159.              ELSE
  160.                 Adaptor$ = "Video Graphics Array"
  161.              END IF
  162.         CASE 7 TO 10
  163.              Adaptor$ = "Enhanced Graphics Adaptor"
  164.         CASE 3
  165.              Adaptor$ = "Hercules Graphics Card"
  166.         CASE 2
  167.              Adaptor$ = "Colour Graphics Adaptor"
  168.         CASE ELSE
  169.              Adaptor$ = "Monochrome Display Adaptor"
  170.     END SELECT
  171.  
  172.     Mouse% = MouseInit%                         ' See if a mouse is available
  173.  
  174.     DIM Menu$(0 TO 12)                          ' Dimension array for menus
  175.     HotKeys% = FALSE                            ' Disable hotkeys in menus
  176.     Printer% = 1                                ' Use the first parallel port
  177.     RootName$ = "DEMON"                         ' Used for help topic files
  178.     DOS$ = "DOS " + DosVersion$                 ' Check current DOS version
  179.     Lc$ = "abcdefghijklmnopqrstuvwxyz"          ' Lowercase letters
  180.     Uc$ = UCASE$(Lc$)                           ' Uppercase letters
  181.     Nu$ = "0123456789"                          ' Numerals
  182.     VFln$ = "\._^$~!#%&-@`({})'"                ' Legal pathname characters
  183.  
  184.     DY$ = MID$(DATE$, 4, 2): DY% = VAL(DY$)     ' What day is this?
  185.     MO$ = LEFT$(DATE$, 2): MO% = VAL(MO$)       ' What month is this?
  186.     YR$ = RIGHT$(DATE$, 2): YR% = VAL(YR$)      ' What year is this?
  187.     Now$ = DY$ + "/" + MO$ + "/" + YR$          ' Format it as DD/MM/YY
  188.  
  189.     ToDay$ = LongDate$(DY%, MO%, YR%)           ' Translate date into words
  190.  
  191. '┌────────────────────────────────────────────────────────────────────────┐
  192. '│      Main Menu.                                                        │
  193. '└────────────────────────────────────────────────────────────────────────┘
  194. '
  195.     ReSeed TIMER
  196. D001:
  197.     Head$ = "ASSEMBLY-LANGUAGE TOOLBOX FOR QuickBASIC"
  198.     LOCATE , , 0: Frame Head$, 1: Bar% = 1
  199. D002:
  200.     IF MaxRes% < 1 THEN
  201.        Menu$(0) = "WSFKME X"
  202.     ELSE
  203.        Menu$(0) = "WSFKMEGX"
  204.     END IF
  205.     Menu$(1) = "&Windows": Menu$(2) = "&Screen"
  206.     Menu$(3) = "&Files": Menu$(4) = "&Keyboard"
  207.     Menu$(5) = "&Memory": Menu$(6) = "&Examples"
  208.     Menu$(7) = "&Graphics": Menu$(8) = "E&xit"
  209.     Abort% = FALSE: HotKey% = FALSE
  210.     IF Nxt% THEN
  211.        IF Bar% = 1 THEN Bar% = 8
  212.        IF Bar% = 9 THEN Bar% = 2
  213.     END IF
  214.     BarMenu 3, BarColour%, 8, Menu$(), Bar%, Nxt%, 1, RootName$,_
  215.             Mouse%, HotKeys%
  216.     SELECT CASE Bar%
  217.         CASE 1
  218.              GOTO D100
  219.         CASE 2
  220.              GOTO D200
  221.         CASE 3
  222.              GOTO D300
  223.         CASE 4
  224.              GOTO D400
  225.         CASE 5
  226.              GOTO D500
  227.         CASE 6
  228.              GOTO D600
  229.         CASE 7
  230.              GOTO D700
  231.         CASE 8
  232.              GOTO D800
  233.         CASE 9
  234.              HelpMate 0, "", 0, ""
  235.         CASE ELSE
  236.              Ok% = Verify%(1, 9, "Exit program, are you sure", 0, Mouse%)
  237.              IF Ok% THEN GOTO Egress
  238.     END SELECT
  239. GOTO D002
  240.  
  241. '┌────────────────────────────────────────────────────────────────────────┐
  242. '│      Popup Window Demonstration.                                       │
  243. '└────────────────────────────────────────────────────────────────────────┘
  244. '
  245. D100:
  246.     A$ = STRING$(1680, "░"): FastPrint 4, 1, A$, 30
  247.     FastPrint 25, 1, SPACE$(80), StatColour%: A$ = ""
  248.     FastPrint 25, 2, Adaptor$, StatColour%
  249.     FastPrint 25, 71, DOS$, StatColour%
  250.     FOR M% = 1 TO 3
  251.         Area% = 0: O% = 0: B% = 1
  252.         DO
  253.             H% = Rand%(5, 10): W% = Rand%(14, 40)
  254.             Area% = Area% + (H% + 1) * (W% + 1)
  255.             IF Area% > 7200 THEN EXIT DO
  256.             K% = Rand%(4, 24 - H%): J% = Rand%(1, 79 - W%)
  257.             R% = Rand%(1, 4): S% = Rand%(1, 4)
  258.             Attrib% = Attribute%(15, B%)
  259.             PopUp K%, J%, H%, W%, Attrib%, R%, S%, -1
  260.             FastPrint K%, J% + ((W% \ 2) - 5), "[ WINDOW ]", Attrib%
  261.             O% = O% + 1: B% = B% + 1: IF B% > 6 THEN B% = 1
  262.          LOOP UNTIL O% = 30
  263.          IF (M% = 3) THEN SLEEP 3 ELSE SLEEP 1
  264.          FOR I% = O% TO 1 STEP -1
  265.              ShutUp -1
  266.          NEXT I%
  267.     NEXT M%
  268.     PopUp 4, 15, 10, 30, 52, 4, 1, -1: PopUp 3, 36, 13, 40, 47, 3, 1, -1
  269.     PopUp 9, 10, 13, 40, 31, 2, 1, -1: PopUp 12, 42, 11, 36, 67, 1, 1, -1
  270.     PopUp 2, 31, 5, 20, 78, 2, 1, -1: FastPrint 4, 34, "Presenting ...", 78
  271.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 7)
  272.     PopUp 8, 20, 7, 40, Attrib%, 2, 1, -1
  273.     FastPrint 8, 31, "[ QUICK  WINDOWS ]", Attrib%
  274.     FastPrint 10, 29, "Windowing Routines for", Attrib%
  275.     FastPrint 11, 30, "Microsoft QuickBASIC", Attrib%
  276.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 3)
  277.     PopUp 17, 55, 7, 24, Attrib%, 1, 3, -1
  278.     FastPrint 19, 58, "        By       ", Attrib%
  279.     FastPrint 20, 58, " Christy Gemmell ", Attrib%
  280.     FastPrint 21, 58, "       and       ", Attrib%
  281.     FastPrint 22, 58, "Singular Software", Attrib%
  282.     SLEEP 3: KeyFlush: Attrib% = Attribute%(14, 1)
  283.     PopUp 13, 2, 10, 23, Attrib%, 2, 4, 0
  284.     FastPrint 15, 4, "A Library of screen", Attrib%
  285.     FastPrint 16, 4, "handling procedures", Attrib%
  286.     FastPrint 17, 4, "and functions which", Attrib%
  287.     FastPrint 18, 4, "can be incorporated", Attrib%
  288.     FastPrint 19, 4, "in your QuickBASIC", Attrib%
  289.     FastPrint 20, 9, "programs.", Attrib%
  290.     SLEEP 4: KeyFlush: Attrib% = Attribute%(15, 1)
  291.     PopUp 16, 27, 5, 26, Attrib%, 2, 1, 0
  292.     FastPrint 18, 30, "HOLD ONTO YOUR HATS", Attrib%
  293.     SLEEP 2: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  294.     Attrib% = 112: PopUp 9, 16, 8, 50, Attrib%, 2, 2, 0: RESTORE Blurb
  295.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  296.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, Attrib%
  297.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, Attrib%: NEXT
  298.     SLEEP 5: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 2)
  299.     PopUp 5, 5, 6, 35, Attrib%, 0, 1, -1
  300.     SLEEP 3: ShutUp -1: Scroll 1, 10, 17, 15, 64, 0, 112
  301.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  302.     SLEEP 6: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 6)
  303.     PopUp 6, 5, 8, 35, Attrib%, 0, 2, -1
  304.     FastPrint 6, 15, "[  No  Frame  ]", Attrib%
  305.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(11, 1)
  306.     PopUp 7, 8, 8, 35, Attrib%, 1, 2, -1
  307.     FastPrint 7, 17, "[ Frame Style 1 ]", Attrib%
  308.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 2)
  309.     PopUp 8, 11, 8, 35, Attrib%, 2, 2, -1
  310.     FastPrint 8, 20, "[ Frame Style 2 ]", Attrib%
  311.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(0, 3)
  312.     PopUp 9, 14, 8, 35, Attrib%, 3, 2, -1
  313.     FastPrint 9, 23, "[ Frame Style 3 ]", Attrib%
  314.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(14, 4)
  315.     PopUp 10, 17, 8, 35, Attrib%, 4, 2, -1
  316.     FastPrint 10, 26, "[ Frame Style 4 ]", Attrib%
  317.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(12, 5)
  318.     PopUp 11, 20, 8, 35, Attrib%, 5, 2, -1
  319.     FastPrint 11, 29, "[ Frame Style 5 ]", Attrib%
  320.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(13, 6)
  321.     PopUp 12, 23, 8, 35, Attrib%, 6, 2, -1
  322.     FastPrint 12, 32, "[ Frame Style 6 ]", Attrib%
  323.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(15, 2)
  324.     PopUp 13, 26, 8, 35, Attrib%, 7, 2, -1
  325.     FastPrint 13, 35, "[ Frame Style 7 ]", Attrib%
  326.     SLEEP 1: KeyFlush: IF Colour% THEN Attrib% = Attribute%(1, 3)
  327.     PopUp 14, 29, 8, 35, Attrib%, 8, 2, -1
  328.     FastPrint 14, 39, "[ Frame Style 8 ]", Attrib%
  329.     SLEEP 4: KeyFlush: FOR I% = 1 TO 9: ShutUp -1: NEXT
  330.     Scroll 1, 10, 17, 15, 64, 0, 112
  331.     FOR I% = 11 TO 13: READ Me$: FastPrint I%, 20, Me$, 112: NEXT
  332.     SLEEP 6: KeyFlush
  333.     FOR I% = 1 TO 15
  334.         Label$ = "[ Colour:" + STR$(I%) + " ]"
  335.         J% = Rand%(1, 51): K% = Rand%(1, 13)
  336.         Attrib% = Attribute%(I%, 0)
  337.         PopUp K% + 1, J% + 1, 7, 24, Attrib%, 4, 0, 0
  338.         FastPrint K% + 1, J% + 6, Label$, Attrib%
  339.         SLEEP 1: KeyFlush
  340.     NEXT I%
  341.     Attrib% = Attribute%(31, B%)
  342.     PopUp 7, 20, 7, 24, Attrib%, 4, 2, 0
  343.     FastPrint 7, 25, "[ Colour: 31 ]", Attrib%
  344.     SLEEP 4: KeyFlush: FOR I% = 1 TO 16: ShutUp 0: NEXT
  345.     Scroll 1, 10, 17, 15, 64, 0, 112
  346.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  347.     SLEEP 6: KeyFlush: Attrib% = Attribute%(15, 1)
  348.     PopUp 2, 2, 11, 30, Attrib%, 7, 0, 0
  349.     SLEEP 3: KeyFlush: ShutUp 0: Scroll 1, 10, 17, 15, 64, 0, 112
  350.     FOR I% = 12 TO 13: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  351.     SLEEP 6: KeyFlush: Attrib% = Attribute%(14, 5)
  352.     PopUp 5, 5, 10, 30, Attrib%, 2, 1, 0
  353.     FastPrint 9, 14, "Left Shadow", Attrib%
  354.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 2)
  355.     PopUp 5, 45, 10, 30, Attrib%, 2, 2, 0
  356.     FastPrint 9, 54, "Right Shadow", Attrib%
  357.     SLEEP 2: KeyFlush: ShutUp 0: ShutUp 0
  358.     Scroll 1, 10, 17, 15, 64, 0, 112
  359.     FastPrint 12, 31, "Windows can be zoomed", 112
  360.     FastPrint 13, 33, "onto the screen.", 112
  361.     SLEEP 3: KeyFlush: Attrib% = Attribute%(0, 2)
  362.     PopUp 2, 2, 15, 60, Attrib%, 2, 0, -1
  363.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  364.     PopUp 13, 10, 10, 60, Attrib%, 3, 0, -1
  365.     SLEEP 2: KeyFlush: Attrib% = Attribute%(14, 5)
  366.     PopUp 7, 33, 10, 45, Attrib%, 1, 0, -1
  367.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  368.     IF NOT Colour% THEN Attrib% = 112
  369.     PopUp 7, 10, 12, 63, Attrib%, 2, 1, -1
  370.     FastPrint 12, 32, "<<< W O W >>>", Attrib%
  371.     SLEEP 3: KeyFlush: FOR I% = 1 TO 4: ShutUp -1: NEXT
  372.     Scroll 1, 10, 17, 15, 64, 0, 112
  373.     FOR I% = 10 TO 14: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  374.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  375.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  376.     SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  377.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  378.     SLEEP 6: KeyFlush: Attrib% = Attribute%(0, 2)
  379.     PopUp 3, 5, 15, 45, Attrib%, 4, 1, -1
  380.     FastPrint 9, 14, "This is the first level ...", Attrib%
  381.     SLEEP 2: KeyFlush: Attrib% = Attribute%(15, 4)
  382.     PopUp 6, 29, 17, 50, Attrib%, 4, 1, -1
  383.     FastPrint 12, 40, "This is the second level ...", Attrib%
  384.     SLEEP 2: KeyFlush: Attrib% = Attribute%(0, 3)
  385.     PopUp 9, 22, 15, 35, Attrib%, 4, 1, -1
  386.     FastPrint 16, 26, "This is the third level ...", Attrib%
  387.     SLEEP 2: KeyFlush: FastPrint 16, 26, "Now to go back ...         ", Attrib%
  388.     SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 2
  389.     Scroll 1, 10, 17, 15, 64, 0, 112: KeyFlush
  390.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  391.     Ok% = Verify%(1, 9, "Are you enjoying this program", 0, Mouse%)
  392.     Scroll 1, 10, 17, 15, 64, 0, 112
  393.     IF Ok% THEN
  394.        FastPrint 11, 28, "You sound very positive!", 112
  395.     ELSE
  396.        FastPrint 11, 28, "You sound very negative!", 112
  397.     END IF
  398.     SLEEP 2: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  399.     FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  400.     SLEEP 3: KeyFlush: SL% = StatusLine%("Want to carry on?")
  401.     IF SL% = 78 OR SL% = 110 OR SL% = 27 THEN
  402.        ShutUp -1
  403.     ELSE
  404.        A$ = STRING$(44, SL%)
  405.        FOR I% = 10 TO 15: FastPrint I%, 19, A$, 112: NEXT
  406.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  407.        FOR I% = 10 TO 15: READ Me$: FastPrint I%, 19, Me$, 112: NEXT
  408.        SLEEP 6: KeyFlush: Scroll 1, 10, 17, 15, 64, 0, 112
  409.        Ready% = PrinTest%(Printer%)
  410.        IF Ready% THEN
  411.           FastPrint 11, 30, "PRINTER CONTROL MENU", 112
  412.           FastPrint 13, 24, "The Toolbox contains versions for", 112
  413.           FastPrint 14, 27, "two other popular printers.", 112
  414.           FastPrint 25, 2, "Press <ESC> to Abort       ", StatColour%
  415.           PrintSet 4, 51, 0, Printer%, Mouse%
  416.           FastPrint 25, 1, SPACE$(80), StatColour%
  417.           FastPrint 25, 2, Adaptor$, StatColour%
  418.           FastPrint 25, 71, DOS$, StatColour%
  419.           SLEEP 5: KeyFlush
  420.        END IF
  421.        ShutUp -1
  422.        PopUp 4, 15, 10, 30, 52, 4, 1, -1
  423.        PopUp 3, 36, 13, 40, 47, 3, 1, -1
  424.        PopUp 9, 10, 13, 40, 78, 2, 1, -1
  425.        PopUp 12, 42, 11, 36, 67, 1, 1, -1
  426.        PopUp 9, 16, 8, 52, 112, 2, 1, -1
  427.        FastPrint 11, 20, "The video routines in the Toolbox Library", 112
  428.        FastPrint 12, 20, "give you all you need to create powerful", 112
  429.        FastPrint 13, 20, "and professional screen displays in your", 112
  430.        FastPrint 14, 20, "QuickBASIC programs.", 112: SLEEP 9: KeyFlush
  431.        FOR I% = 1 TO 5: ShutUp -1: SLEEP 1: KeyFlush: NEXT
  432.        IF NOT Ready% THEN
  433.           PopUp 10, 18, 5, 44, 96, 1, 2, 0
  434.           Me$ = "Pity you didn't have a printer connected"
  435.           FastPrint 12, 20, Me$, 96: SLEEP 5: KeyFlush: ShutUp 0
  436.        END IF
  437.     END IF
  438. GOTO D001
  439.  
  440. '┌────────────────────────────────────────────────────────────────────────┐
  441. '│      Screen control functions.                                         │
  442. '└────────────────────────────────────────────────────────────────────────┘
  443. '
  444. D200:
  445.     Menu$(0) = "F#SC#B"
  446.     Menu$(1) = "&Fast screen printing"
  447.     Menu$(3) = "&Selective scrolling"
  448.     Menu$(4) = "&Clear to the end"
  449.     Menu$(6) = "&Background colours"
  450.     VerMenu 4, 3, BarColour%, 1, 6, "SCREEN CONTROL", Menu$(),_
  451.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  452.     IF Nxt% THEN GOTO D002
  453.     SELECT CASE Choice%
  454.         CASE 1
  455.              GOTO D210
  456.         CASE 3
  457.              GOTO D220
  458.         CASE 4
  459.              GOTO D230
  460.         CASE 6
  461.              GOTO D240
  462.         CASE ELSE
  463.     END SELECT
  464. GOTO D002
  465.  
  466. '   Screen print demonstration
  467. '
  468. D210:
  469.     A$ = STRING$(1680, "«"): B$ = STRING$(1680, "»")
  470.     FOR I% = 1 TO 255
  471.         FastPrint 4, 1, A$, I%: FastPrint 4, 1, B$, I%
  472.         IF INKEY$ = CHR$(27) THEN EXIT FOR
  473.     NEXT I%
  474.     IF I% = 256 THEN
  475.        A$ = "": B$ = "": C$ = STRING$(1680, "░"): Attrib% = 30
  476.        FastPrint 4, 1, C$, Attrib%: C$ = ""
  477.        IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  478.        PopUp 12, 21, 7, 40, Attrib%, 3, 4, -1
  479.        FastPrint 15, 33, "<<< W O W >>>", Attrib%
  480.        SLEEP 5: KeyFlush: ShutUp -1
  481.     END IF
  482. GOTO D200
  483.  
  484. '   Selective scrolling demonstration
  485. '
  486. D220:
  487.     Panel 4, 1, 21, 80, 1, TextColour%
  488.     IF Colour% THEN BackGround% = 7 ELSE BackGround% = 0
  489.     Clr% = 1: IF Mouse% THEN MouseShow
  490.     DO
  491.        Scroll 0, 4, 21, 7, 60, 1, Attribute%(0, Clr%)
  492.        Scroll 2, 9, 6, 19, 20, 1, Attribute%(0, Clr%)
  493.        Scroll 3, 9, 61, 19, 75, 1, Attribute%(0, Clr%)
  494.        Scroll 1, 21, 21, 24, 60, 1, Attribute%(0, Clr%)
  495.        COLOR Clr%, BackGround%
  496.        LOCATE 19, 25: PRINT "SCROLLING UP";
  497.        Scroll 0, 9, 23, 19, 38, 1, Attribute%(Clr%, BackGround%)
  498.        LOCATE 9, 43: PRINT "SCROLLING DOWN";
  499.        Scroll 1, 9, 41, 19, 58, 1, Attribute%(Clr%, BackGround%)
  500.        Pause 1: Clr% = Clr% + 1
  501.        IF Clr% = BackGround% THEN Clr% = Clr% + 1
  502.        IF Clr% > 7 THEN Clr% = 1
  503.        IF Mouse% THEN
  504.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  505.           IF LeftButton% THEN
  506.              IF yMouse% > 15 AND yMouse% < 24 THEN
  507.                 Z$ = CHR$(32): EXIT DO
  508.              END IF
  509.           END IF
  510.        END IF
  511.        Z$ = INKEY$
  512.     LOOP UNTIL Z$ = CHR$(27)
  513.     IF Mouse% THEN
  514.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  515.     END IF
  516. GOTO D200
  517.  
  518. '   Clear to end of line or screen
  519. '
  520. D230:
  521.     Panel 4, 1, 24, 80, 1, TextColour%
  522.     IF Colour% THEN Attrib% = 15 ELSE Attrib% = 112
  523.     FastPrint 22, 30, "Press a key to do it", TextColour%
  524.     FastPrint 10, 3, "Clear end of line >", TextColour%
  525.     LOCATE 10, 22, 1: R$ = INPUT$(1): ClearEnd 0, Attrib%
  526.     FastPrint 15, 3, "Clear end of screen >", TextColour%
  527.     LOCATE 15, 24, 1: R$ = INPUT$(1): ClearEnd 1, Attrib%
  528.     LOCATE , , 0: Frame Head$, 0
  529. GOTO D200
  530.  
  531. D240:
  532.     FastPrint 25, 1, SPACE$(80), StatColour%
  533.     FastPrint 25, 3, "Press any key, <Esc> to abort", StatColour%
  534.     RANDOMIZE TIMER: IF Mouse% THEN MouseShow
  535.     DO
  536.        Row% = Rand%(5, 20): Col% = Rand%(2, 62): Rows% = Rand%(1, 16)
  537.        IF Row% + Rows% > 23 THEN Rows% = 24 - Row%
  538.        Cols% = Rand%(1, 60): IF Col% + Cols% > 78 THEN Cols% = 79 - Col%
  539.        Attrib% = Rand%(0, 255): BackFill Row%, Col%, Rows%, Cols%, Attrib%
  540.        DO
  541.           IF Mouse% THEN
  542.              MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  543.              IF LeftButton% THEN
  544.                 IF yMouse% > 15 AND yMouse% < 24 THEN
  545.                    Z$ = CHR$(27)
  546.                    EXIT DO
  547.                 ELSE
  548.                    Z$ = CHR$(32)
  549.                    EXIT DO
  550.                 END IF
  551.              END IF
  552.           END IF
  553.           Z$ = INKEY$
  554.        LOOP UNTIL Z$ <> ""
  555.     LOOP UNTIL Z$ = CHR$(27)
  556.     Frame Head$, 0: IF Mouse% THEN MouseHide:
  557.     IF Z$ <> CHR$(27) THEN GOTO D002
  558. GOTO D200
  559.  
  560. '┌────────────────────────────────────────────────────────────────────────┐
  561. '│      File Functions.                                                   │
  562. '└────────────────────────────────────────────────────────────────────────┘
  563. '
  564. D300:
  565.     Menu$(0) = "WH#S"
  566.     Menu$(1) = "&Where's that file?"
  567.     Menu$(2) = "&How big is that file?"
  568.     Menu$(4) = "&Sort that file"
  569.     Abort% = FALSE
  570.     VerMenu 4, 9, BarColour%, 1, 4, "FILE FUNCTIONS", Menu$(),_
  571.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  572.     IF Nxt% THEN GOTO D002
  573.     SELECT CASE Choice%
  574.         CASE 1
  575.              GOTO D310
  576.         CASE 2
  577.              GOTO D320
  578.         CASE 4
  579.              GOTO D330
  580.         CASE ELSE
  581.     END SELECT
  582. GOTO D002
  583.  
  584. '   File Finder
  585. '
  586. D310:
  587.     Panel 4, 1, 21, 80, 1, TextColour%
  588.     RESTORE Finder
  589.     FOR I% = 1 TO 13
  590.         READ Me$: FastPrint 5 + I%, 14, Me$, TextColour%
  591.     NEXT I%
  592.     Scroll 1, 19, 2, 21, 79, 0, TextColour%
  593.     PopUp 19, 19, 4, 44, 96, 2, 2, -1: HotKey% = FALSE
  594.     FastPrint 20, 28, "Enter name of file to find", 96
  595.     LOCATE 21, 21: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + ":*?"
  596.     PathName$ = RevInput$(40, 0, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  597.     ShutUp -1
  598.     IF HotKey% THEN
  599.        Abort% = TRUE
  600.     ELSE
  601.        PathName$ = RTRIM$(LTRIM$(PathName$))
  602.        Found$ = FindFile$(PathName$, 0, Mouse%)
  603.        IF Found$ <> "" THEN
  604.           Found$ = LTRIM$(RTRIM$(Found$))
  605.           OT% = 40 - (LEN(Found$) \ 2)
  606.           FastPrint 20, OT%, Found$, TextColour%
  607.        END IF
  608.     END IF
  609. GOTO D300
  610.  
  611. D320:
  612.     Panel 4, 1, 21, 80, 1, TextColour%
  613.     RESTORE Size
  614.     FOR I% = 1 TO 12
  615.         READ Me$: FastPrint 5 + I%, 8, Me$, TextColour%
  616.     NEXT I%
  617.     Scroll 1, 18, 3, 23, 78, 0, TextColour%: HotKey% = FALSE
  618.     LOCATE 20, 20: Legal$ = Uc$ + Lc$ + Nu$ + VFln$ + "*?"
  619.     PathName$ = RevInput$(64, 40, "", Legal$, 1, "REVINPUT", 0, HotKey%)
  620.     IF HotKey% THEN
  621.        Abort% = TRUE
  622.     ELSE
  623.        PathName$ = LTRIM$(RTRIM$(PathName$))
  624.        IF PathName$ = "" THEN PathName$ = "*.*"
  625.        IF IsDir%(PathName$) THEN PathName$ = PathName$ + "\*.*"
  626.        FastPrint 20, 8, SPACE$(64), TextColour%
  627.        FastPrint 20, 8, PathName$, TextColour%
  628.        Bytes& = FileSize&(PathName$)
  629.        IF Bytes& > 0 THEN
  630.           Me$ = "Size = " + LTRIM$(RTRIM$(STR$(Bytes&))) + " bytes"
  631.           FastPrint 22, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  632.        ELSE
  633.           MisTake 9, "No match found!", 0, Mouse%
  634.        END IF
  635.     END IF
  636. GOTO D300
  637.  
  638. '   File sorter.
  639. '
  640. D330:
  641.     Panel 4, 1, 21, 80, 1, TextColour%
  642.     RESTORE Sorts
  643.     FOR I% = 1 TO 10
  644.         READ Me$: FastPrint 4 + I%, 8, Me$, TextColour%
  645.     NEXT I%
  646.     IF FileSize&("SAMPLE.DAT") < 1 THEN
  647.        MisTake 9, "Can't find SAMPLE data file to sort!", 0, Mouse%
  648.     ELSE
  649.        IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  650.        PopUp 16, 3, 8, 74, Attrib%, 1, 4, -1
  651.        FastPrint 16, 36, " SAMPLE.DAT ", Attrib%
  652.        OPEN "SAMPLE.DAT" FOR INPUT AS #1
  653.        FOR I% = 1 TO 6
  654.            LINE INPUT #1, A$: OL% = LEN(A$)
  655.            Me$ = LEFT$(A$, OL% - 2)
  656.            FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  657.        NEXT I%
  658.        CLOSE 1: SL% = StatusLine%("To begin sorting ...")
  659.        SortFile "SAMPLE.DAT", 1, 10, OL% + 2, Done%
  660.        IF Done% THEN
  661.           OPEN "SAMPLE.DAT" FOR INPUT AS #1
  662.           FOR I% = 1 TO 6
  663.               LINE INPUT #1, A$: OL% = LEN(A$)
  664.               Me$ = LEFT$(A$, OL% - 2)
  665.               FastPrint 16 + I%, 40 - (OL% \ 2) + 1, Me$, Attrib%
  666.           NEXT I%
  667.           CLOSE 1
  668.           SL% = StatusLine%("File successfully sorted"): ShutUp -1
  669.        ELSE
  670.           ShutUp -1
  671.           FastPrint 21, 30, "Unable to sort file", TextColour%
  672.        END IF
  673.     END IF
  674. GOTO D300
  675.  
  676. '┌────────────────────────────────────────────────────────────────────────┐
  677. '│      Keyboard functions and procedures.                                │
  678. '└────────────────────────────────────────────────────────────────────────┘
  679. '
  680. D400:
  681.     Menu$(0) = "AKT#M"
  682.     Menu$(1) = "&ASCII and scan codes"
  683.     Menu$(2) = "&Keyboard shift flags"
  684.     Menu$(3) = "&Typeahead buffer"
  685.     Menu$(5) = "&Mouse position and status"
  686.     VerMenu 4, 16, BarColour%, 1, 5, "KEYBOARD AND MOUSE", Menu$(),_
  687.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  688.     IF Nxt% THEN GOTO D002
  689.     SELECT CASE Choice%
  690.         CASE 1
  691.              GOTO D410
  692.         CASE 2
  693.              GOTO D420
  694.         CASE 3
  695.              GOTO D430
  696.         CASE 5
  697.              GOTO D440
  698.         CASE ELSE
  699.     END SELECT
  700. GOTO D002
  701.  
  702. '   Indexes to the font table in ROM-BIOS, then translates the pixel
  703. '   values of the character specified by a keypress, into a large-
  704. '   scale representation of that character.
  705. '
  706. D410:
  707.     Panel 4, 1, 21, 80, 1, TextColour%
  708.     Fore$ = STRING$(2, "█"): Back$ = STRING$(2, "░")
  709.     FastPrint 6, 31, "┌────────────────┐", TextColour%
  710.     FOR Row% = 7 TO 14
  711.         FastPrint Row%, 31, "│" + STRING$(16, "░") + "│", TextColour%
  712.     NEXT Row%
  713.     FastPrint 15, 31, "└────────────────┘", TextColour%
  714.     FastPrint 25, 1, SPACE$(80), StatColour%
  715.     FastPrint 25, 3, "Press any key, or <Esc> to abort", StatColour%
  716.     LOCATE 21, 40, 1: Abort% = FALSE: CALL KeyFlush
  717.     DO
  718.         Character% = KeyIn%: IF Character% = 27 THEN EXIT DO
  719.         FastPrint 21, 40, " ", TextColour%
  720.         FastPrint 16, 10, SPACE$(60), TextColour%
  721.         SELECT CASE Character%
  722.             CASE 0 TO 127
  723.                  FOR Row% = 1 TO 8
  724.                      Pixel% = FarPeek%(&HF000, &HFA6D + (Character% * 8)_
  725.                             + Row%)
  726.                      IF Pixel% = 0 THEN
  727.                         FastPrint Row% + 6, 32, STRING$(16, "░"), TextColour%
  728.                      ELSE
  729.                         Col% = 32
  730.                         FOR Column% = 7 TO 0 STEP -1
  731.                             IF Pixel% < 2 ^ Column% THEN
  732.                                FastPrint Row% + 6, Col%, Back$, TextColour%
  733.                             ELSE
  734.                                FastPrint Row% + 6, Col%, Fore$, TextColour%
  735.                                Pixel% = Pixel% - 2 ^ Column%
  736.                             END IF
  737.                             Col% = Col% + 2
  738.                         NEXT Column%
  739.                      END IF
  740.                  NEXT Row%
  741.             CASE ELSE
  742.                  IF Character% < 0 THEN
  743.                     Me$ = SPACE$(16)
  744.                  ELSE
  745.                     Me$ = STRING$(16, Character%)
  746.                  END IF
  747.                  FOR Row% = 1 TO 8
  748.                      FastPrint Row% + 6, 32, Me$, TextColour%
  749.                  NEXT Row%
  750.         END SELECT
  751.         IF Character% < 0 THEN
  752.            Me$ = "Scan Code " + LTRIM$(RTRIM$(STR$(ABS(Character%))))
  753.         ELSE
  754.            Me$ = "ASCII Code " + LTRIM$(RTRIM$(STR$(Character%)))
  755.         END IF
  756.         FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  757.     LOOP WHILE 1
  758.     LOCATE , , 0: Frame Head$, 0
  759. GOTO D400
  760.  
  761. '   Keyboard shift flags.
  762. '
  763. D420:
  764.     Panel 4, 1, 21, 80, 1, TextColour%
  765.     ShiftFlags% = KeyFlags%: Flag$ = STRING$(16, "0")
  766.     FOR I% = 15 TO 0 STEP -1
  767.         IF BitTest%(ShiftFlags%, I%) THEN
  768.            MID$(Flag$, 16 - I%, 1) = "1"
  769.         END IF
  770.     NEXT I%
  771.     FastPrint 5, 40, "Keyboard Status Word at 0040:0017", TextColour%
  772.     FastPrint 7, 40, "Bit settings (1 = set)", TextColour%
  773.     FastPrint 5, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  774.     FastPrint 6, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  775.     FastPrint 7, 3, "│", TextColour%: Col% = 4
  776.     FOR I% = 1 TO 16
  777.         FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  778.         Col% = Col% + 2
  779.     NEXT I%
  780.     FastPrint  8, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  781.     FastPrint  9, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ │ └─┴─", TextColour%
  782.     FastPrint 10, 3, " │ │ │ │ │ │ │ │ │ │ │ │ │ └─────", TextColour%
  783.     FastPrint 11, 3, " │ │ │ │ │ │ │ │ │ │ │ │ └───────", TextColour%
  784.     FastPrint 12, 3, " │ │ │ │ │ │ │ │ │ │ │ └─────────", TextColour%
  785.     FastPrint 13, 3, " │ │ │ │ │ │ │ │ │ │ └───────────", TextColour%
  786.     FastPrint 14, 3, " │ │ │ │ │ │ │ │ │ └─────────────", TextColour%
  787.     FastPrint 15, 3, " │ │ │ │ │ │ │ │ └───────────────", TextColour%
  788.     FastPrint 16, 3, " │ │ │ │ │ │ │ └─────────────────", TextColour%
  789.     FastPrint 17, 3, " │ │ │ │ │ │ └───────────────────", TextColour%
  790.     FastPrint 18, 3, " │ │ │ │ │ └─────────────────────", TextColour%
  791.     FastPrint 19, 3, " │ │ │ │ └───────────────────────", TextColour%
  792.     FastPrint 20, 3, " │ │ │ └─────────────────────────", TextColour%
  793.     FastPrint 21, 3, " │ │ └───────────────────────────", TextColour%
  794.     FastPrint 22, 3, " │ └─────────────────────────────", TextColour%
  795.     FastPrint 23, 3, " └───────────────────────────────", TextColour%
  796.     FastPrint 25, 1, SPACE$(80), StatColour%
  797.     FastPrint 25, 3, "Press <Esc> to abort", StatColour%
  798.     RESTORE Shift
  799.     FOR I% = 1 TO 15
  800.         READ Me$: FastPrint I% + 8, 40, Me$, TextColour%
  801.     NEXT I%
  802.     IF Mouse% THEN MouseShow
  803.     DO
  804.         ShiftFlags% = KeyFlags%
  805.         FOR I% = 15 TO 0 STEP -1
  806.             IF BitTest%(ShiftFlags%, I%) THEN
  807.                MID$(Flag$, 16 - I%, 1) = "1"
  808.             ELSE
  809.                MID$(Flag$, 16 - I%, 1) = "0"
  810.             END IF
  811.         NEXT I%
  812.         Col% = 4
  813.         FOR I% = 1 TO 16
  814.             FastPrint 7, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  815.             Col% = Col% + 2
  816.         NEXT I%
  817.         CL% = CapsLock%(2)
  818.         IF CL% THEN
  819.            FastPrint 25, 65, "CAPS", 14
  820.         ELSE
  821.            FastPrint 25, 65, "    ", StatColour%
  822.         END IF
  823.         NL% = NumLock%(2)
  824.         IF NL% THEN
  825.            FastPrint 25, 70, "NUM", 14
  826.         ELSE
  827.            FastPrint 25, 70, "   ", StatColour%
  828.         END IF
  829.         SL% = ScrLock%(2)
  830.         IF SL% THEN
  831.            FastPrint 25, 74, "SCRL", 14
  832.         ELSE
  833.            FastPrint 25, 74, "    ", StatColour%
  834.         END IF
  835.         IF Mouse% THEN
  836.            MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  837.            IF LeftButton% THEN
  838.               IF yMouse% > 15 AND yMouse% < 24 THEN
  839.                  Z$ = CHR$(32): EXIT DO
  840.               END IF
  841.            END IF
  842.         END IF
  843.         Z$ = INKEY$
  844.     LOOP UNTIL Z$ = CHR$(27)
  845.     Frame Head$, 0
  846.     IF Mouse% THEN
  847.        CALL MouseHide: IF Z$ <> CHR$(27) THEN GOTO D002
  848.     END IF
  849. GOTO D400
  850.  
  851. '   Keyboard typeahead buffer.
  852. '
  853. D430:
  854.     COLOR 7, 0: Panel 4, 1, 21, 80, 1, 14
  855.     RESTORE KeyBuff: READ Items%
  856.     FOR I% = 1 TO Items%
  857.         READ Row%, Col%, Me$: LOCATE Row%, Col%, 0: PRINT Me$;
  858.     NEXT I%
  859.     LOCATE 11, 68: COLOR 11
  860.     Start% = &H400 + FarPeek%(&H40, &H80)
  861.     Finish% = &H400 + FarPeek%(&H40, &H82)
  862.     PRINT RIGHT$("0000" + HEX$(Start%), 4); " ";
  863.     PRINT RIGHT$("0000" + HEX$(Finish%), 4);
  864.     DO
  865.         Hd% = &H400 + FarPeek%(&H40, &H1A)
  866.         Tl% = &H400 + FarPeek%(&H40, &H1C)
  867.         LOCATE 11, 4: COLOR 11
  868.         PRINT RIGHT$("0000" + HEX$(Hd%), 4); " ";
  869.         PRINT RIGHT$("0000" + HEX$(Tl%), 4);
  870.         COLOR 13: LOCATE 9, 17: PRINT SPACE$(48);
  871.         LOCATE 9, 17 + ((Hd% - &H41E) \ 2) * 3: PRINT CHR$(25);
  872.         COLOR 12: LOCATE 13, 17: PRINT SPACE$(48);
  873.         LOCATE 13, 17 + ((Tl% - &H41E) \ 2) * 3: PRINT CHR$(24);
  874.         FOR I% = 0 TO 15
  875.             C% = FarPeek%(&H40, &H1E + (I% * 2))
  876.             S% = FarPeek%(&H40, &H1E + (I% * 2) + 1)
  877.             IF C% < 32 THEN Ky$ = "  " ELSE Ky$ = CHR$(C%) + " "
  878.             LOCATE 11, 17 + (I% * 3): COLOR 14: PRINT Ky$;
  879.             LOCATE 14, 17 + (I% * 3): COLOR 9
  880.             PRINT RIGHT$("0" + HEX$(C%), 2);
  881.             LOCATE 15, 17 + (I% * 3): COLOR 10
  882.             PRINT RIGHT$("0" + HEX$(S%), 2);
  883.         NEXT I%
  884.         IF Hd% >= Tl% THEN
  885.            Kys% = 16 - ((Hd% - Tl%) \ 2)
  886.         ELSE
  887.            Kys% = (Tl% - Hd%) \ 2
  888.         END IF
  889.         LOCATE 14, 76: IF Kys% = 16 THEN Kys% = 0
  890.         PRINT RIGHT$(" " + LTRIM$(RTRIM$(STR$(Kys%))), 2);
  891.         IF Kys% = 15 THEN
  892.            LOCATE 15, 67: COLOR 28: PRINT "BUFFER FULL";
  893.            SLEEP 2: KeyFlush: LOCATE , 67: PRINT SPACE$(11);
  894.         END IF
  895.     LOOP UNTIL FarPeek%(&H40, (Tl% - &H400) - 2) = 27
  896.     COLOR 7, 0: LOCATE 20, 1, 0
  897.     Dummy$ = INPUT$(Kys%)
  898. GOTO D400
  899.  
  900. '   Report mouse cursor position and status.
  901. '
  902. D440:
  903.     IF Mouse% THEN
  904.        Panel 4, 1, 21, 80, 1, TextColour%
  905.        CALL MouseShow
  906.        DO
  907.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  908.           Me$ = "x=" + LTRIM$(RTRIM$(STR$(xMouse%))) + "  "
  909.           FastPrint 12, 31, Me$, TextColour%
  910.           Me$ = "y=" + LTRIM$(RTRIM$(STR$(yMouse%))) + "  "
  911.           FastPrint 12, 41, Me$, TextColour%
  912.           IF LeftButton% THEN
  913.              IF yMouse% > 15 AND yMouse% < 24 THEN
  914.                 EXIT DO
  915.              ELSE
  916.                 Me$ = "Left button pressed"
  917.              END IF
  918.           ELSE
  919.              Me$ = "                   "
  920.           END IF
  921.           FastPrint 14, 31, Me$, TextColour%
  922.           IF RightButton% THEN
  923.              Me$ = "Right button pressed"
  924.           ELSE
  925.              Me$ = "                    "
  926.           END IF
  927.           FastPrint 15, 31, Me$, TextColour%: Z$ = INKEY$
  928.        LOOP UNTIL Z$ = CHR$(27)
  929.        CALL MouseHide
  930.        IF Z$ <> CHR$(27) THEN GOTO D002
  931.     ELSE
  932.        MisTake 9, "Mouse driver not installed", 0, Mouse%
  933.     END IF
  934. GOTO D400
  935.  
  936. '┌────────────────────────────────────────────────────────────────────────┐
  937. '│      Memory-related functions and procedures.                          │
  938. '└────────────────────────────────────────────────────────────────────────┘
  939. '
  940. D500:
  941.     IF EmsPresent% THEN Menu$(0) = "F#E" ELSE Menu$(0) = "F# "
  942.     Menu$(1) = "Operating system &Flags"
  943.     Menu$(3) = "&Expanded memory services"
  944.     Abort% = FALSE
  945.     VerMenu 4, 26, BarColour%, 1, 3, "MEMORY", Menu$(),_
  946.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  947.     IF Nxt% THEN GOTO D002
  948.     SELECT CASE Choice%
  949.         CASE 1
  950.              GOTO D510
  951.         CASE 3
  952.              GOTO D520
  953.         CASE ELSE
  954.     END SELECT
  955. GOTO D002
  956.  
  957. '┌────────────────────────────────────────────────────────────────────────┐
  958. '│      System Flags.                                                     │
  959. '└────────────────────────────────────────────────────────────────────────┘
  960. '
  961. D510:
  962.     DIM CoOrd%(16, 2): Context% = 1: Topic$ = "FLAGS"
  963.     Panel 4, 1, 21, 80, 1, TextColour%: RESTORE Flags
  964.     FOR I% = 6 TO 21
  965.         READ Me$: FastPrint I%, 6, Me$, TextColour%
  966.     NEXT I%
  967.     Panel 6, 50, 16, 27, 2, 48
  968.     FastPrint 7, 53, "CURRENT FLAG SETTINGS", 48
  969.     FastPrint 8, 50, "╟" + STRING$(25, "─") + "╢", 48
  970.     FOR I% = 10 TO 17
  971.         READ Me$: FastPrint I%, 52, Me$, 48
  972.     NEXT I%
  973.     FOR I% = 1 TO 16
  974.         READ CoOrd%(I%, 1), CoOrd%(I%, 2): F% = GetFlag%(I%)
  975.         F$ = LTRIM$(RTRIM$(STR$(F%))): F$ = RIGHT$("   " + F$, 3)
  976.         FastPrint CoOrd%(I%, 1), CoOrd%(I%, 2), F$, 48
  977.     NEXT I%
  978.     FastPrint 19, 52, "Enter Flag Number:", 48
  979.     FastPrint 25, 3, SPACE$(78), StatColour%
  980.     FastPrint 25, 3, "Press <ESC> to Abort", StatColour%
  981.     DO
  982.        LOCATE 19, 73: HotKey% = FALSE
  983.        Number$ = RevInput$(2, 0, Number$, Nu$, 1, "REVINPUT", 0, HotKey%)
  984.        IF HotKey% THEN
  985.           Abort% = TRUE
  986.        ELSE
  987.           Number% = VAL(Number$)
  988.           IF Number% < 1 OR Number% > 16 THEN
  989.              BEEP
  990.           ELSE
  991.              Number$ = LTRIM$(RTRIM$(STR$(Number%)))
  992.              Number$ = RIGHT$("  " + Number$, 2)
  993.              FastPrint 19, 73, Number$, 48
  994.              Setting% = GetFlag%(Number%)
  995.              Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  996.              LOCATE CoOrd%(Number%, 1), CoOrd%(Number%, 2)
  997.              Setting$ = RevInput$(3, 0, Setting$, Nu$, 1, "REVINPUT",_
  998.                                   0, HotKey%)
  999.              IF HotKey% THEN
  1000.                 Abort% = TRUE
  1001.              ELSE
  1002.                 Setting% = VAL(Setting$)
  1003.                 IF Setting% < 0 OR Setting% > 255 THEN
  1004.                    BEEP
  1005.                 ELSE
  1006.                    SetFlag Number%, Setting%
  1007.                 END IF
  1008.                 Setting% = GetFlag%(Number%)
  1009.                 Setting$ = RIGHT$("   " + LTRIM$(RTRIM$(STR$(Setting%))), 3)
  1010.                 FastPrint CoOrd%(Number%, 1), CoOrd%(Number%, 2), Setting$, 48
  1011.              END IF
  1012.           END IF
  1013.        END IF
  1014.     LOOP UNTIL Abort%
  1015.     ERASE CoOrd%: Frame Head$, 0
  1016. GOTO D500
  1017.  
  1018. '┌────────────────────────────────────────────────────────────────────────┐
  1019. '│      Expanded Memory services.                                         │
  1020. '└────────────────────────────────────────────────────────────────────────┘
  1021. '
  1022. D520:
  1023.     Panel 4, 1, 21, 80, 1, TextColour%: Handle% = FALSE
  1024.     FastPrint 6, 23, "┌─────────────────────────────────┐", TextColour%
  1025.     FastPrint 7, 23, "│  EXPANDED MEMORY DEMONSTRATION  │", TextColour%
  1026.     FastPrint 8, 23, "└─────────────────────────────────┘", TextColour%
  1027.     Version% = EmsVersion%: PageFrame% = EmsFrame%
  1028.     EmsTotal% = EmsPages%(0): EmsFree% = EmsPages%(1)
  1029.     LIM$ = LTRIM$(RTRIM$(STR$(Version%))): L% = LEN(LIM$)
  1030.     IF L% > 1 THEN LIM$ = LEFT$(LIM$, L% - 1) + "." + RIGHT$(LIM$, 1)
  1031.     Me$ = "You have" + STR$(EmsTotal% * 16) + " KiloBytes of LIM "_
  1032.         + LIM$ + " Expanded Memory installed."
  1033.     FastPrint 10, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1034.     Me$ = "The Page Frame segment is at address " + HEX$(PageFrame%) + " Hex,"
  1035.     FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1036.     Me$ = "and there are" + STR$(EmsFree%) + " pages ("_
  1037.         + LTRIM$(RTRIM$(STR$(EmsFree% * 16))) + "KB) free."
  1038.     FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1039.     IF EmsFree% < 4 THEN
  1040.        Me$ = "Sorry, that's not enough for this demonstration."
  1041.        FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%: GOTO D525
  1042.     END IF
  1043.     SLEEP 1: KeyFlush: Me$ = "Requesting four pages for this demonstration,"
  1044.     FastPrint 14, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1045.     EmsRequest 4, Handle%: IF Handle% = 0 THEN GOTO D529
  1046.     Pages% = EmsOwned%(Handle%): IF Pages% < 4 THEN GOTO D529
  1047.     Me$ = "they have been assigned to Handle" + STR$(Handle%) + "."
  1048.     FastPrint 15, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1049.     Me$ = "Saving this screen to page 1": SLEEP 1: KeyFlush
  1050.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1051.     IF Colour% THEN Segment% = &HB800 ELSE Segment% = &HB000
  1052.     SLEEP 1: KeyFlush: Me$ = "Drawing and saving three other screens ...."
  1053.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1054.     EmsPut Segment%, 0, 4000, 1, Handle%, Done%
  1055.     IF NOT Done% THEN GOTO D529
  1056.     SLEEP 1: KeyFlush: FastPrint 25, 1, SPACE$(80), StatColour%
  1057.     Page% = 2: Row% = 11: Col% = 35
  1058.     RESTORE Numbers
  1059.     DO
  1060.         READ Columns%, BackGround%: IF NOT Colour% THEN BackGround% = 0
  1061.         Attr% = Attribute%(15, BackGround%)
  1062.         BackFill 4, 1, 21, 80, Attr%
  1063.         Scroll 1, 9, 2, 23, 79, 0, Attr%
  1064.         FastPrint 10, 36, "P A G E", Attr%
  1065.         FOR I% = 1 TO Columns%
  1066.             READ Item$: IF Item$ = "F" THEN Item$ = "12345678"
  1067.             FOR J% = 1 TO LEN(Item$)
  1068.                 Rows% = VAL(MID$(Item$, J%, 1))
  1069.                 FastPrint Row% + Rows%, Col% + I%, CHR$(219), Attr%
  1070.             NEXT J%
  1071.         NEXT I%
  1072.         EmsPut Segment%, 0, 4000, Page%, Handle%, Done%
  1073.         Page% = Page% + 1: IF NOT Done% THEN EXIT DO
  1074.         SLEEP 1: KeyFlush
  1075.     LOOP UNTIL Page% > 4
  1076.     IF NOT Done% THEN GOTO D529
  1077.     EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1078.     IF NOT Done% THEN GOTO D529
  1079.     Me$ = "Now I'll let YOU bring 'em back again ...."
  1080.     FastPrint 19, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1081.     FastPrint 22, 24, "Press a key when you're ready >", TextColour%
  1082.     LOCATE 22, 56, 1: Page% = 4: IF KeyIn% = 27 THEN GOTO D525
  1083.     DO
  1084.        EmsGet Segment%, 0, 4000, Page%, Handle%, Done%
  1085.        IF NOT Done% THEN EXIT DO
  1086.        FastPrint 25, 63, "Press a key >", StatColour%
  1087.        LOCATE 25, 77: KeyPress% = KeyIn%
  1088.        Page% = Page% - 1
  1089.     LOOP WHILE Page% > 1
  1090.     IF Done% THEN EmsGet Segment%, 0, 4000, 1, Handle%, Done%
  1091.     LOCATE , , 0: IF NOT Done% THEN GOTO D529
  1092.     Me$ = "The demonstration was completely successful, which proves that"
  1093.     FastPrint 17, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1094.     Me$ = "your Expanded Memory is in good working order."
  1095.     FastPrint 18, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1096. D525:
  1097.     IF Handle% THEN
  1098.        SLEEP 1: KeyFlush: EmsRelease Handle%
  1099.        Me$ = "We released all pages assigned to handle" + STR$(Handle%)_
  1100.            + " before finishing,"
  1101.        FastPrint 20, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1102.        Me$ = "otherwise no other program would have been able to use them."
  1103.        FastPrint 21, 40 - (LEN(Me$) \ 2), Me$, TextColour%
  1104.     END IF
  1105.     SLEEP 2: KeyFlush
  1106. GOTO D500
  1107.  
  1108. D529:
  1109.     Me$ = "An EMM error" + STR$(EmsError%) + " has just occurred ..."
  1110.     MisTake 12, Me$, 0, Mouse%
  1111. GOTO D525
  1112.  
  1113. '┌────────────────────────────────────────────────────────────────────────┐
  1114. '│      Miscellaneous functions and procedures.                           │
  1115. '└────────────────────────────────────────────────────────────────────────┘
  1116. '
  1117. D600:
  1118.     Menu$(0) = "DHEFP"
  1119.     Menu$(1) = "&Date entry and validation"
  1120.     Menu$(2) = "&Hardware equipment list"
  1121.     Menu$(3) = "&Encryption of text"
  1122.     Menu$(4) = "&Fast string sorting"
  1123.     Menu$(5) = "&Percentage box"
  1124.     Abort% = FALSE
  1125.     VerMenu 4, 34, BarColour%, 1, 5, "EXAMPLES", Menu$(),_
  1126.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1127.     IF Nxt% THEN GOTO D002
  1128.     SELECT CASE Choice%
  1129.         CASE 1
  1130.              GOTO D610
  1131.         CASE 2
  1132.              GOTO D620
  1133.         CASE 3
  1134.              GOTO D630
  1135.         CASE 4
  1136.              GOTO D640
  1137.         CASE 5
  1138.              GOTO D650
  1139.         CASE ELSE
  1140.     END SELECT
  1141. GOTO D002
  1142.  
  1143. '┌────────────────────────────────────────────────────────────────────────┐
  1144. '│      Long Date Routine.                                                │
  1145. '└────────────────────────────────────────────────────────────────────────┘
  1146. '
  1147. D610:
  1148.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1149.     HotKey% = FALSE: IF ToDay$ = "" THEN ToDay$ = SPACE$(20)
  1150.     Context% = 1: Topic$ = "LONGDATE": WW% = LEN(ToDay$)
  1151.     WT% = 41 - (WW% \ 2): PopUp 8, 24, 8, 34, Attrib%, 3, 2, -1
  1152.     FastPrint 9, 33, "Today's date is:", Attrib%
  1153.     FastPrint 10, WT%, ToDay$, Attrib%
  1154.     Ok% = Verify%(1, 12, "Is this correct", 0, Mouse%)
  1155.     IF NOT Ok% THEN
  1156.        FastPrint 12, 32, "Enter correct date", Attrib%
  1157.        Temp$ = "": LOCATE 14, 37
  1158.        Temp$ = DateInput$(Temp$, 1, "DATINPUT", HotKey%)
  1159.        IF HotKey% THEN
  1160.           Abort% = TRUE
  1161.        ELSE
  1162.           Now$ = Temp$: MO% = VAL(MID$(Temp$, 4, 2))
  1163.           DY% = VAL(LEFT$(Temp$, 2)): YR% = VAL(RIGHT$(Temp$, 2))
  1164.           ToDay$ = LongDate$(DY%, MO%, YR%): OL% = LEN(ToDay$)
  1165.           IF OL% > 0 THEN
  1166.              FastPrint 25, 41, SPACE$(40), StatColour%
  1167.              FastPrint 25, 79 - OL%, ToDay$, StatColour%
  1168.           END IF
  1169.        END IF
  1170.     END IF
  1171.     ShutUp -1
  1172. GOTO D600
  1173.  
  1174. '┌────────────────────────────────────────────────────────────────────────┐
  1175. '│      Equipment List.                                                   │
  1176. '└────────────────────────────────────────────────────────────────────────┘
  1177. '
  1178. D620:
  1179.     Panel 4, 1, 21, 80, 1, TextColour%
  1180.     Cols$ = "80": Video$ = "colour": REDIM Model(0 TO 8) AS STRING
  1181.     RESTORE HWare: FOR I% = 0 TO 8: READ Model(I%): NEXT
  1182.     Equipment% = PeekWord&(&H40, &H10): Flag$ = STRING$(16, "0")
  1183.     Computer% = FarPeek%(&HF000, &HFFFE)
  1184.     Computer% = Computer% - &HF8: IF Computer% < 0 THEN Computer% = 0
  1185.     FastPrint 8, 38, "IBM " + Model(Computer%) + " or compatible", TextColour%
  1186.     Chip% = Cpu%: CoPro% = MathsChip%
  1187.     SELECT CASE Chip%
  1188.         CASE IS < 0
  1189.              Me$ = " an Intel 80C" + LTRIM$(RTRIM$(STR$(ABS(Chip%))))
  1190.         CASE 20, 30
  1191.              Me$ = " a NEC V" + LTRIM$(RTRIM$(STR$(Chip%)))
  1192.         CASE 88 TO 486
  1193.              Me$ = " an Intel 80" + LTRIM$(RTRIM$(STR$(Chip%)))
  1194.         CASE ELSE
  1195.              Me$ = " an unknown"
  1196.     END SELECT
  1197.     Me$ = "with" + Me$ + " microprocessor"
  1198.     FastPrint 9, 38, Me$, TextColour%
  1199.     FOR I% = 15 TO 0 STEP -1
  1200.         IF BitTest%(Equipment%, I%) THEN
  1201.            MID$(Flag$, 16 - I%, 1) = "1"
  1202.         END IF
  1203.     NEXT I%
  1204.     FastPrint  8, 3, " F E D C B A 9 8 7 6 5 4 3 2 1 0", TextColour%
  1205.     FastPrint  9, 3, "┌─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┐", TextColour%
  1206.     FastPrint 10, 3, "│", TextColour%: Col% = 4
  1207.     FOR I% = 1 TO 16
  1208.         FastPrint 10, Col%, MID$(Flag$, I%, 1) + "│", TextColour%
  1209.         Col% = Col% + 2
  1210.     NEXT I%
  1211.     FastPrint 10, 38, "ROM BIOS Equipment Flag at 0040:0010", TextColour%
  1212.     FastPrint 11, 3, "└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘", TextColour%
  1213.     FastPrint 12, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ │", TextColour%
  1214.     FastPrint 13, 3, " │ │   │ │ │ │   │ │ │ │ │ │ │ └─", TextColour%
  1215.     FastPrint 14, 3, " │ │   │ │ │ │   │ │ │ │ │ │ └───", TextColour%
  1216.     FastPrint 15, 3, " │ │   │ │ │ │   │ │ │ │ └─┴─────", TextColour%
  1217.     FastPrint 16, 3, " │ │   │ │ │ │   │ │ └─┴─────────", TextColour%
  1218.     FastPrint 17, 3, " │ │   │ │ │ │   └─┴─────────────", TextColour%
  1219.     FastPrint 18, 3, " │ │   │ └─┴─┴───────────────────", TextColour%
  1220.     FastPrint 19, 3, " │ │   └─────────────────────────", TextColour%
  1221.     FastPrint 20, 3, " └─┴─────────────────────────────", TextColour%
  1222.     FastPrint 13, 38, "Floppy drives installed?", TextColour%
  1223.     IF MID$(Flag$, 16, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1224.     FastPrint 13, 68, Me$, TextColour%
  1225.     FastPrint 14, 38, "Maths coprocessor installed?", TextColour%
  1226.     IF MID$(Flag$, 15, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1227.     IF CoPro% > 0 THEN Me$ = "80" + LTRIM$(RTRIM$(STR$(CoPro%)))
  1228.     FastPrint 14, 68, Me$, TextColour%
  1229.     FastPrint 15, 38, "Original PC motherboard RAM", TextColour%
  1230.     IF Computer% = 1 THEN
  1231.        Ram% = (BinDec&(MID$(Flag$, 13, 2)) + 1) * 16
  1232.        Me$ = RIGHT$("  " + LTRIM$(RTRIM$(STR$(Ram%))), 2) + "KB"
  1233.     ELSE
  1234.        Me$ = "n/a"
  1235.     END IF
  1236.     FastPrint 15, 68, Me$, TextColour%
  1237.     FastPrint 16, 38, "Initial Video mode", TextColour%
  1238.     Mode% = BinDec&(MID$(Flag$, 11, 2))
  1239.     IF Mode% = 1 THEN Cols$ = "40"
  1240.     IF Mode% = 7 THEN Video$ = "mono"
  1241.     FastPrint 16, 58, Cols$ + " column " + Video$, TextColour%
  1242.     FastPrint 17, 38, "Number of floppy drives", TextColour%
  1243.     Mode% = BinDec&(MID$(Flag$, 9, 2)) + 1
  1244.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 17, 68, Me$, TextColour%
  1245.     FastPrint 18, 38, "Number of serial ports", TextColour%
  1246.     Mode% = BinDec&(MID$(Flag$, 5, 3)) + 1
  1247.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 18, 68, Me$, TextColour%
  1248.     FastPrint 19, 38, "Games adaptor installed?", TextColour%
  1249.     IF MID$(Flag$, 3, 1) = "1" THEN Me$ = "Yes" ELSE Me$ = "No"
  1250.     FastPrint 19, 68, Me$, TextColour%
  1251.     FastPrint 20, 38, "Number of parallel printers", TextColour%
  1252.     Mode% = BinDec&(LEFT$(Flag$, 2))
  1253.     Me$ = LTRIM$(RTRIM$(STR$(Mode%))): FastPrint 20, 68, Me$, TextColour%
  1254.     FastPrint 25, 1, SPACE$(80), StatColour%
  1255.     FastPrint 25, 3, "Press a key to continue", StatColour%
  1256.     IF Mouse% THEN MouseShow
  1257.     DO
  1258.        IF Mouse% THEN
  1259.           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1260.           IF LeftButton% THEN
  1261.              IF yMouse% > 15 AND yMouse% < 24 THEN
  1262.                 Z$ = "": EXIT DO
  1263.              END IF
  1264.           END IF
  1265.        END IF
  1266.        Z$ = INKEY$
  1267.     LOOP WHILE Z$ = ""
  1268.     Frame Head$, 0: ERASE Model
  1269.     IF Mouse% THEN
  1270.        CALL MouseHide: IF Z$ = "" THEN GOTO D002
  1271.     END IF
  1272. GOTO D600
  1273.  
  1274. '   Text Encryption.
  1275. '
  1276. D630:
  1277.     Panel 4, 1, 21, 80, 1, TextColour%
  1278.     Done% = FALSE: Abort% = FALSE: HotKey% = FALSE
  1279.     Text$ = "": Code$ = ""
  1280.     RESTORE Crypt
  1281.     FOR I% = 1 TO 5
  1282.         READ Me$: FastPrint 6 + I%, 11, Me$, TextColour%
  1283.     NEXT I%
  1284.     IF Colour% THEN Attrib% = 32 ELSE Attrib% = 112
  1285.     DO WHILE Text$ = ""
  1286.        PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1287.        FastPrint 18, 27, "Enter string to be encrypted", Attrib%
  1288.        LOCATE 19, 21
  1289.        Text$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1290.        ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1291.        Text$ = LTRIM$(RTRIM$(Text$))
  1292.        IF Text$ = "" THEN
  1293.           MisTake 9, "You can't encrypt an empty string!", 0, Mouse%
  1294.        END IF
  1295.     LOOP
  1296.     IF NOT Abort% THEN
  1297.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1298.        DO WHILE Code$ = ""
  1299.           PopUp 17, 19, 4, 44, Attrib%, 2, 2, -1
  1300.           FastPrint 18, 25, "Enter string to encrypt it with", Attrib%
  1301.           LOCATE 19, 21
  1302.           Code$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1303.           ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1304.           Code$ = LTRIM$(RTRIM$(Code$))
  1305.           IF Code$ = "" THEN
  1306.              MisTake 12, "An empty string is no use!", 0, Mouse%
  1307.           END IF
  1308.        LOOP
  1309.        IF NOT Abort% THEN
  1310.           Cipher Text$, Code$: Me$ = "Encrypted string >  " + Text$
  1311.           FastPrint 14, 11, Me$, TextColour%
  1312.           IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1313.           DO
  1314.              DO
  1315.                 PopUp 19, 19, 4, 44, Attrib%, 2, 2, -1
  1316.                 FastPrint 20, 27, "Enter key string once again", Attrib%
  1317.                 LOCATE 21, 21
  1318.                 DeCode$ = RevInput$(40, 0, "", "", 1, "REVINPUT", -1, HotKey%)
  1319.                 ShutUp -1: IF HotKey% THEN Abort% = TRUE: EXIT DO
  1320.                 DeCode$ = LTRIM$(RTRIM$(DeCode$))
  1321.                 IF DeCode$ = "" THEN
  1322.                    MisTake 12, "An empty string is no use!", 0, Mouse%
  1323.                 END IF
  1324.              LOOP WHILE DeCode$ = ""
  1325.              IF Abort% THEN
  1326.                 Done% = TRUE
  1327.              ELSE
  1328.                 Me$ = Text$: Cipher Me$, DeCode$
  1329.                 Me$ = "Decrypted string >  " + Me$
  1330.                 FastPrint 16, 11, Me$, TextColour%
  1331.                 IF Code$ = DeCode$ THEN
  1332.                    FastPrint 19, 33, "That's the one!", TextColour%
  1333.                    Done% = TRUE
  1334.                 ELSE
  1335.                    Me$ = "Whoops, that's not right"
  1336.                    IF MisMatch% THEN
  1337.                       Me$ = Me$ + " either"
  1338.                    END IF
  1339.                    MisTake 9, Me$ + "!", 0, Mouse%
  1340.                    MisMatch% = TRUE
  1341.                 END IF
  1342.              END IF
  1343.           LOOP UNTIL Done%
  1344.        END IF
  1345.     END IF
  1346. GOTO D600
  1347.  
  1348. '   Demonstrate string array sorting and scan routines.
  1349. '
  1350. D640:
  1351.     Room% = TRUE: Me$ = "Not enough memory for sort array"
  1352.     ON ERROR GOTO D645
  1353.     REDIM Array(1 TO 1000) AS STRING
  1354.     ON ERROR GOTO Trap
  1355.     IF NOT Room% THEN GOTO D600
  1356.     RESTORE Strings: IF Colour% THEN COLOR 0, 7
  1357.     Panel 4, 1, 21, 80, 1, TextColour%
  1358.     FOR Row% = 6 TO 7
  1359.         READ Me$: LOCATE Row%, 3: PRINT Me$
  1360.     NEXT Row%
  1361.     FOR I% = 1 TO 1000
  1362.         FOR J% = 1 TO Rand%(5, 11)
  1363.             Array(I%) = Array(I%) + CHR$(Rand%(0, 25) + 65)
  1364.         NEXT J%
  1365.     NEXT I%
  1366.     LOCATE 7, 50: PRINT "done!"
  1367.     LOCATE 9, 3: PRINT "Unsorted array"
  1368.     FOR I% = 1 TO 3
  1369.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1370.         LOCATE 10 + I%, 3: PRINT Me$; " "; Array(I%)
  1371.     NEXT I%
  1372.     LOCATE 14, 3: PRINT "  .": Row% = 15
  1373.     FOR I% = 998 TO 1000
  1374.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1375.         LOCATE Row%, 3: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1376.     NEXT I%
  1377.     PopUp 19, 13, 5, 53, BarColour%, 4, 4, 0
  1378.     READ Me$: FastPrint 21, 15, Me$, BarColour%
  1379.     LOCATE 21, 62: Legal$ = "AaDd"
  1380.     A$ = UCASE$(RevInput$(1, 0, "A", Legal$, 1, "REVINPUT", 0, HotKey%))
  1381.     ShutUp 0: IF Colour% THEN COLOR 0, 7
  1382.     IF HotKey% THEN Abort% = TRUE: GOTO D642
  1383.     IF A$ = "D" THEN
  1384.        Direction% = 1: A$ = "descending"
  1385.     ELSE
  1386.        Direction% = 0: A$ = "ascending"
  1387.     END IF
  1388.     LOCATE 19, 3: PRINT "Sorting the array into "; A$; " order ....";
  1389.     First% = LBOUND(Array): Last% = UBOUND(Array)
  1390.     X! = TIMER
  1391.     StringSort Direction%, 1000, VARPTR(Array(First%))
  1392.     Y! = TIMER
  1393.     PRINT " done!": LOCATE 9, 41: PRINT "Sorted array"
  1394.     FOR I% = 1 TO 3
  1395.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1396.         LOCATE 10 + I%, 41: PRINT Me$; " "; Array(I%)
  1397.     NEXT I%
  1398.     LOCATE 14, 41: PRINT "  .": Row% = 15
  1399.     FOR I% = 998 TO 1000
  1400.         Me$ = "Element " + RIGHT$("    " + LTRIM$(RTRIM$(STR$(I%))), 4)
  1401.         LOCATE Row%, 41: PRINT Me$; " "; Array(I%): Row% = Row% + 1
  1402.     NEXT I%
  1403.     LOCATE 20, 3: PRINT USING "The sort took ###.### seconds"; Y! - X!
  1404.     Ok% = Verify%(1, 16, "Search array", 0, Mouse%): IF NOT Ok% THEN GOTO D642
  1405. D641:
  1406.     PopUp 12, 17, 8, 46, BarColour%, 3, 4, -1: HotKey% = 0
  1407.     FastPrint 14, 20, "Enter a string to insert into the array", BarColour%
  1408.     LOCATE 15, 30: A$ = RevInput$(20, 0, "", "", 1, "REVINPUT", 0, HotKey%)
  1409.     IF HotKey% THEN Abort% = TRUE: ShutUp -1: GOTO D642
  1410.     A$ = LTRIM$(RTRIM$(A$))
  1411.     Me$ = "Enter element to insert it into (1-"_
  1412.         + LTRIM$(RTRIM$(STR$(Last%))) + ") "
  1413.     FastPrint 16, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1414.     LOCATE 17, 38: Temp$ = RevInput$(4, 0, "", Nu$, 1, "REVINPUT", 0, HotKey%)
  1415.     ShutUp -1: IF Colour% THEN COLOR 0, 7
  1416.     IF HotKey% THEN
  1417.        Abort% = TRUE: GOTO D642
  1418.     ELSE
  1419.        S% = VAL(Temp$)
  1420.        IF S% < First% OR S% > Last% THEN
  1421.           MisTake 9, "OUT OF RANGE!", 0, Mouse%
  1422.           GOTO D641
  1423.        ELSE
  1424.           Array(S%) = A$
  1425.           IF S% < 4 THEN
  1426.              LOCATE 10 + S%, 54: PRINT SPACE$(12);
  1427.              LOCATE 10 + S%, 54: PRINT A$;
  1428.           ELSEIF S% > 997 THEN
  1429.              LOCATE S% - 983, 54: PRINT SPACE$(12);
  1430.              LOCATE S% - 983, 54: PRINT A$;
  1431.           END IF
  1432.        END IF
  1433.     END IF
  1434.     LOCATE 21, 3: PRINT "Scanning array for " + A$ + " .... ";
  1435.     X! = TIMER
  1436.     Match% = StringScan%(A$, 1000, First%, VARPTR(Array$(First%)))
  1437.     Y! = TIMER
  1438.     PRINT "found it at element"; Match%
  1439.     LOCATE 22, 3: PRINT USING "The search took ###.### seconds"; Y! - X!
  1440. D642:
  1441.     ERASE Array: IF Colour% THEN COLOR 7, 0
  1442. GOTO D002
  1443.  
  1444. D645:
  1445.     MisTake 9, Me$, 0, Mouse%
  1446.     Room% = FALSE
  1447. RESUME NEXT
  1448.  
  1449. '   Display a popup window with a percentage bar measuring the progress
  1450. '   of a function or procedure.
  1451. '
  1452. D650:
  1453.     PerCentBox 1, "Passing the time away", 0, 0
  1454.     StartTime& = TIMER
  1455.     DO
  1456.         ThisTime& = TIMER - StartTime&
  1457.         Percentage% = (ThisTime& / 30) * 100
  1458.         PerCentBox 2, "", 0, Percentage%
  1459.         IF INKEY$ = CHR$(27) THEN EXIT DO
  1460.     LOOP UNTIL ThisTime& > 30
  1461.     PerCentBox 3, "", 0, 0
  1462. GOTO D600
  1463.  
  1464. '┌────────────────────────────────────────────────────────────────────────┐
  1465. '│      Graphics examples.                                                │
  1466. '└────────────────────────────────────────────────────────────────────────┘
  1467. '
  1468. D700:
  1469.     VideoMode Colour%, MaxRes%, VideoRam%
  1470.     IF MaxRes% > 8 THEN
  1471.        Menu$(0) = "CP#SR"
  1472.     ELSEIF MaxRes% AND MaxRes% <> 3 THEN
  1473.        Menu$(0) = "C #  "
  1474.     ELSE
  1475.        Menu$(0) = "  #  "
  1476.     END IF
  1477.     Menu$(1) = "Graphics &characters"
  1478.     Menu$(2) = "Video &panning"
  1479.     Menu$(4) = "&Save screen to file"
  1480.     Menu$(5) = "&Restore screen"
  1481.     VerMenu 4, 47, BarColour%, 1, 5, "GRAPHICS", Menu$(),_
  1482.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1483.     IF Nxt% THEN GOTO D002
  1484.     SELECT CASE Choice%
  1485.         CASE 1
  1486.              GOTO D710
  1487.         CASE 2
  1488.              GOTO D720
  1489.         CASE 4, 5
  1490.              GOTO D730
  1491.         CASE ELSE
  1492.     END SELECT
  1493. GOTO D002
  1494.  
  1495. '┌────────────────────────────────────────────────────────────────────────┐
  1496. '│      Graphics characters.                                              │
  1497. '└────────────────────────────────────────────────────────────────────────┘
  1498. '
  1499. D710:
  1500.     SELECT CASE MaxRes%
  1501.         CASE 2                                  ' Colour Graphics Adaptor
  1502.              Mode = 1
  1503.              SCREEN 1                           ' 320 x 200   4-colour
  1504.         CASE 9                                  ' Enhanced Graphics Adaptor
  1505.              Mode = 2
  1506.              SCREEN 9                           ' 640 x 350  16-colour
  1507.              WINDOW SCREEN (0, 0)-(319, 199)
  1508.         CASE 13
  1509.              IF VideoRam% > 64 THEN
  1510.                 Mode = 3                        ' Video Graphics Array
  1511.                 SCREEN 12                       ' 640 X 480  16-colour
  1512.                 WINDOW SCREEN (0, 0)-(319, 199)
  1513.              ELSE
  1514.                 Mode = 4                        ' Multicolour Graphics Array
  1515.                 SCREEN 13                       ' 320 x 200 256-colour
  1516.              END IF
  1517.         CASE ELSE
  1518.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1519.              GOTO D002
  1520.     END SELECT
  1521.  
  1522.     REDIM Hue(1 TO 4) AS INTEGER
  1523.     PLAY "mft240o3l8d#fgl8b-p8l8gl2b-"          ' Hoop-la!
  1524.     RESTORE Title
  1525.     PLAY "mbl8t255o3bo4cdo3bo4co3abgaf#t120gbt200dp8"
  1526.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1527.     READ Count%, X1%, Y1%, X2%, Y2%
  1528.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1529.     FOR I% = 1 TO Count%
  1530.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1531.     NEXT I%
  1532.     LINE (0, 165)-(259, 165), Hue(Mode)
  1533.     IF Mode = 1 THEN
  1534.        Road$ = CHR$(&H22) + CHR$(11) + CHR$(&H88) + CHR$(44)
  1535.        Tree$ = CHR$(&H11) + CHR$(&H88) + CHR$(&H44) + CHR$(&H22)
  1536.        PAINT (5, 5), 2, Hue(Mode)
  1537.        PAINT (310, 100), 1, Hue(Mode)
  1538.        PAINT (250, 163), Road$, Hue(Mode)
  1539.        PAINT (10, 100), 1, Hue(Mode)
  1540.        LINE (0, 165)-(319, 165), 0
  1541.     ELSE
  1542.        PAINT (5, 5), 9, Hue(Mode)
  1543.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1544.        PAINT (250, 163), 8, Hue(Mode)
  1545.        PAINT (10, 100), Hue(Mode), Hue(Mode)
  1546.        LINE (0, 165)-(319, 165), 0
  1547.     END IF
  1548.     PSET (57, 113), Hue(Mode)
  1549.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1550.     READ Count%, X1%, Y1%, X2%, Y2%
  1551.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1552.     FOR I% = 1 TO Count%
  1553.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1554.     NEXT I%
  1555.     CIRCLE (127, 109), 45, Hue(Mode), 1.35, 3.1, .3
  1556.     CIRCLE (166, 102), 35, Hue(Mode), 1, 2.8, .43
  1557.     CIRCLE (214, 95), 32, Hue(Mode), 1.1, 2.8, .39
  1558.     CIRCLE (259, 94), 38, Hue(Mode), .7, 2.6, .48
  1559.     CIRCLE (296, 96), 33, Hue(Mode), .1, 1.92, .45
  1560.     IF Mode = 1 THEN
  1561.        PAINT (215, 90), Tree$, Hue(Mode)
  1562.     ELSE
  1563.        PAINT (215, 90), Hue(Mode), Hue(Mode)
  1564.     END IF
  1565.     PSET (83, 108), Hue(Mode)
  1566.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1567.     READ Count%, X1%, Y1%, X2%, Y2%
  1568.     LINE (X1%, Y1%)-(X2%, Y2%), Hue(Mode)
  1569.     FOR I% = 1 TO Count%
  1570.         READ X%, Y%: LINE -(X%, Y%), Hue(Mode)
  1571.     NEXT I%
  1572.     LINE (270, 72)-(276, 86), Hue(Mode), BF
  1573.     PAINT (260, 95), Hue(Mode), Hue(Mode)
  1574.     IF Mode = 1 THEN
  1575.        LINE (215, 86)-(260, 73), 0: LINE -(305, 86), 0
  1576.        LINE (226, 88)-(246, 93), 1, BF: LINE (274, 88)-(294, 93), 1, BF
  1577.        LINE (255, 88)-(265, 98), 2, BF: LINE (271, 70)-(272, 71), 0, BF
  1578.        LINE (274, 70)-(275, 71), 0, BF
  1579.     ELSE
  1580.        LINE (215, 86)-(260, 73), 4: LINE -(305, 86), 4
  1581.        LINE (226, 88)-(246, 93), 26, BF: LINE (274, 88)-(294, 93), 26, BF
  1582.        LINE (255, 88)-(265, 98), 6, BF: LINE (271, 70)-(272, 71), 6, BF
  1583.        LINE (274, 70)-(275, 71), 6, BF: LINE (319, 98)-(220, 98), 8
  1584.        LINE -(186, 99), 8: LINE -(159, 101), 8: LINE -(210, 100), 8
  1585.        LINE -(319, 100), 8: PAINT (300, 99), 8, 8
  1586.     END IF
  1587.     PLAY "t255o4cdecdo3bo4co3abgt120f#at200dp8"
  1588.     FOR I% = 1 TO 4: READ Hue(I%): NEXT
  1589.     LINE (320, 102)-(285, 102), Hue(Mode)
  1590.     CIRCLE (292, 102), 6, Hue(Mode), .8, 3.1415, .7
  1591.     CIRCLE (302, 102), 9, Hue(Mode), .8, 2.5, .75
  1592.     CIRCLE (318, 102), 16, Hue(Mode), .6, 2.7, .85
  1593.     IF Mode = 1 THEN
  1594.        LINE (320, 94)-(307, 93), 1
  1595.        PAINT (310, 95), Tree$, Hue(Mode), CHR$(&HAA)
  1596.        GraPrint 256, 78, "A", GrAttrib%(0, 3), 1
  1597.        LINE (76, 6)-(244, 32), 3, BF: LINE (76, 32)-(244, 52), 1, BF
  1598.     ELSE
  1599.        PAINT (310, 100), Hue(Mode), Hue(Mode)
  1600.        IF Mode = 2 THEN
  1601.           GraPrint 495, 136, "Club-PC", GrAttrib%(1, -1), 1
  1602.        ELSEIF Mode = 3 THEN
  1603.           GraPrint 495, 190, "Club-PC", GrAttrib%(1, -1), 1
  1604.        ELSE
  1605.           GraPrint 248, 78, "CPC", GrAttrib%(27, -1), 1
  1606.        END IF
  1607.        LINE (76, 6)-(244, 32), 14, BF: LINE (76, 32)-(244, 52), 15, BF
  1608.     END IF
  1609.     Me$ = "GRAPHICS": I% = 1: X% = 80: Y% = 9
  1610.     IF Mode = 1 THEN
  1611.        Clr% = GrAttrib%(0, 3): Box% = 0
  1612.     ELSE
  1613.        Clr% = GrAttrib%(1, -1): Box% = 1
  1614.     END IF
  1615.     DO
  1616.         LINE (X%, Y%)-(X% + 20, Y% + 20), Box%, B
  1617.         IF Mode = 2 THEN
  1618.            GraPrint ((X% * 2) + 8), (Y% * 1.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1619.         ELSEIF Mode = 3 THEN
  1620.            GraPrint ((X% * 2) + 8), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1621.         ELSE
  1622.            GraPrint X% + 3, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1623.         END IF
  1624.         I% = I% + 1: X% = X% + 20
  1625.     LOOP UNTIL I% > 8
  1626.     Me$ = "CHARACTERS": I% = 1: X% = 78: Y% = 32
  1627.     IF Mode = 1 THEN
  1628.        Clr% = GrAttrib%(2, 1)
  1629.     ELSE
  1630.        Clr% = GrAttrib%(7, -1)
  1631.     END IF
  1632.     DO
  1633.         IF Mode = 2 THEN
  1634.            GraPrint ((X% * 2) + 8), (Y% * 1.6) + 3, MID$(Me$, I%, 1), Clr%, 3
  1635.         ELSEIF Mode = 3 THEN
  1636.            GraPrint ((X% * 2) + 9), (Y% * 2.4) + 3, MID$(Me$, I%, 1), Clr%, 3
  1637.         ELSE
  1638.            GraPrint X% + 5, Y% + 3, MID$(Me$, I%, 1), Clr%, 2
  1639.         END IF
  1640.         I% = I% + 1: X% = X% + 16
  1641.     LOOP UNTIL I% > 10
  1642.     IF Mode = 1 THEN
  1643.        LINE (5, 60)-(175, 145), 0, BF: LINE (4, 59)-(176, 146), 3, B
  1644.     END IF
  1645.     I% = 1: READ Count%
  1646.     DO
  1647.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1648.         IF Mode = 2 THEN
  1649.            GraPrint X% * 2, (Y% * 1.6), Me$, GrAttrib%(Fore%, -1), Scale%
  1650.         ELSEIF Mode = 3 THEN
  1651.            GraPrint X% * 2, (Y% * 2) + 30, Me$, GrAttrib%(Fore%, -1), Scale%
  1652.         ELSE
  1653.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1654.         END IF
  1655.         I% = I% + 1
  1656.     LOOP UNTIL I% > Count%
  1657.     I% = 1: READ Count%
  1658.     DO
  1659.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1660.         IF Mode = 2 THEN
  1661.            GraPrint X% * 3, (Y% * 1.4), Me$, GrAttrib%(Fore%, -1), Scale%
  1662.         ELSEIF Mode = 3 THEN
  1663.            GraPrint X% * 3, Y% * 1.92, Me$, GrAttrib%(Fore%, -1), Scale%
  1664.         ELSE
  1665.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1666.         END IF
  1667.         I% = I% + 1
  1668.     LOOP UNTIL I% > Count%
  1669.     PLAY "mft255ef#gdef#gef#g#aef#g#ag#abo4co3bo4cdeco3af#gdgbt120g"
  1670.     I% = 1: READ Count%
  1671.     DO
  1672.         READ X%, Y%, Me$, Fore%, Back%, Scale%
  1673.         IF Mode = 2 THEN
  1674.            GraPrint X% * 2, Y% * 1.6, Me$, GrAttrib%(Fore%, -1), 2
  1675.         ELSEIF Mode = 3 THEN
  1676.            GraPrint X% * 2, Y% * 2.2, Me$, GrAttrib%(Fore%, -1), 2
  1677.         ELSE
  1678.            GraPrint X%, Y%, Me$, GrAttrib%(Fore%, Back%), Scale%
  1679.         END IF
  1680.         I% = I% + 1
  1681.     LOOP UNTIL I% > Count%
  1682.     DO: LOOP UNTIL KeyIn% = 32
  1683.     SCREEN 0: WIDTH 80
  1684. GOTO D001
  1685.  
  1686. '┌────────────────────────────────────────────────────────────────────────┐
  1687. '│      Video Panning.                                                    │
  1688. '└────────────────────────────────────────────────────────────────────────┘
  1689. '
  1690. D720:
  1691.     IF (MaxRes% = 13 AND VideoRam% > 64) OR MaxRes% > 9 THEN
  1692.        SCREEN 9: LINE (0, 0)-(639, 349), 9, BF
  1693.        VIEW SCREEN (40, 25)-(600, 325), 0, 15
  1694.        CIRCLE (319, 174), 150, 14: PAINT (319, 174), 14, 14
  1695.        X% = 0: Y% = 0
  1696.        DO
  1697.           KeyPress% = KeyIn%: Pan% = TRUE
  1698.           SELECT CASE KeyPress%
  1699.               CASE -75
  1700.                    IF X% > 0 THEN X% = X% - 1
  1701.               CASE -77
  1702.                    IF X% < 79 THEN X% = X% + 1
  1703.               CASE -72
  1704.                    IF Y% > 0 THEN Y% = Y% - 1
  1705.               CASE -80
  1706.                    IF Y% < 22 THEN Y% = Y% + 1
  1707.               CASE ELSE
  1708.                    Pan% = FALSE
  1709.           END SELECT
  1710.           IF Pan% THEN VGAPan X%, Y% * 5
  1711.        LOOP UNTIL KeyPress% = 27
  1712.        SCREEN 0: WIDTH 80
  1713.     ELSE
  1714.        MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1715.     END IF
  1716. GOTO D001
  1717.  
  1718. '┌────────────────────────────────────────────────────────────────────────┐
  1719. '│      Video Save and Restore.                                           │
  1720. '└────────────────────────────────────────────────────────────────────────┘
  1721. '
  1722. D730:
  1723.     SELECT CASE MaxRes%
  1724.         CASE 7
  1725.              xMax% = 319: yMax% = 199: SaveSize& = 32000
  1726.         CASE 8
  1727.              xMax% = 639: yMax% = 199: SaveSize& = 64000
  1728.         CASE 9, 10
  1729.              xMax% = 639: yMax% = 349: SaveSize& = 112000
  1730.         CASE 11, 12
  1731.              xMax% = 639: yMax% = 479: SaveSize& = 153600
  1732.         CASE 13
  1733.              IF VideoRam% > 64 THEN
  1734.                 xMax% = 639: yMax% = 479: SaveSize& = 153600
  1735.                 MaxRes% = 12
  1736.              ELSE
  1737.                 xMax% = 319: yMax% = 199: SaveSize& = 64000
  1738.              END IF
  1739.         CASE ELSE
  1740.              MisTake 9, "Incompatible Video Card!", 0, Mouse%
  1741.              GOTO D002
  1742.     END SELECT
  1743.     IF Choice% = 4 THEN
  1744.        IF FreeSpace&(0) > SaveSize& THEN
  1745.           SCREEN MaxRes%: RESTORE Escher
  1746.           LINE (0, 0)-(xMax%, yMax%), 6, BF
  1747.           VIEW (32, 4)-(xMax% - 32, yMax% - 4), 0, 5
  1748.           WINDOW SCREEN (0, 0)-(255, 191)
  1749.           FOR I% = 1 TO 40
  1750.               READ A%, B%, C%, D%: LINE (A%, B%)-(C%, D%), 1
  1751.           NEXT I%
  1752.           PAINT (56, 20), 1, 1: PAINT (136, 64), 1, 1
  1753.           PAINT (120, 80), 1, 1: PAINT (192, 88), 14, 1
  1754.           PAINT (76, 48), 14, 1: PAINT (124, 60), 14, 1
  1755.           PAINT (68, 12), 2, 1: PAINT (80, 84), 2, 1
  1756.           PAINT (92, 128), 2, 1: PAINT (36, 156), 12, 1
  1757.           PAINT (36, 168), 1, 1: PAINT (84, 178), 14, 1
  1758.           PAINT (88, 118), 12, 1: PAINT (144, 86), 12, 1
  1759.           VGASave "ESCHER.IMG": KeyPress% = KeyIn%
  1760.        ELSE
  1761.           MisTake 9, "Insufficient disk space!", 0, Mouse%
  1762.        END IF
  1763.     ELSE
  1764.        IF FileSize&("ESCHER.IMG") > 0 THEN
  1765.           SCREEN MaxRes%
  1766.           VGALoad "ESCHER.IMG"
  1767.           KeyPress% = KeyIn%
  1768.        ELSE
  1769.           MisTake 9, "Screen Image file not found!", 0, Mouse%
  1770.        END IF
  1771.     END IF
  1772.     SCREEN 0: WIDTH 80
  1773. GOTO D001
  1774.  
  1775. '┌────────────────────────────────────────────────────────────────────────┐
  1776. '│      Program Exit.                                                     │
  1777. '└────────────────────────────────────────────────────────────────────────┘
  1778. '
  1779. D800:
  1780.     Menu$(0) = "ED#A"
  1781.     Menu$(1) = "&Exit program"
  1782.     Menu$(2) = "&DOS shell"
  1783.     Menu$(4) = "&About DEMON"
  1784.     VerMenu 4, 59, BarColour%, 1, 4, "EXIT", Menu$(),_
  1785.             Choice%, Nxt%, Bar%, 1, RootName$, Mouse%, HotKeys%
  1786.     IF Nxt% THEN GOTO D002
  1787.     SELECT CASE Choice%
  1788.         CASE 1
  1789.              GOTO D810
  1790.         CASE 2
  1791.              GOTO D820
  1792.         CASE 4
  1793.              PopUp 9, 14, 9, 53, BarColour%, 4, 4, -1
  1794.              FastPrint 9, 35, " D E M O N ", BarColour%
  1795.              RESTORE About
  1796.              READ Me$: FastPrint 11, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1797.              READ Me$: FastPrint 12, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1798.              READ Me$: FastPrint 13, 40 - (LEN(Me$) \ 2), Me$, BarColour%
  1799.              FastPrint 14, 34, "┌──────────╖", BarColour%
  1800.              FastPrint 15, 34, "│    OK    ║", BarColour%
  1801.              FastPrint 16, 34, "╘══════════╝", BarColour%
  1802.              FastPrint 15, 38, " OK ", 14: Ky% = FALSE
  1803.              IF Mouse% THEN
  1804.                 xHot% = 37 * 8: yHot% = 13 * 8
  1805.                 CALL MouseShow
  1806.              END IF
  1807.              DO
  1808.                 IF KeyStat% THEN
  1809.                    Ky% = KeyIn%
  1810.                 ELSEIF Mouse% THEN
  1811.                    MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1812.                    IF LeftButton% THEN
  1813.                       IF yMouse% > yHot% AND yMouse% < yHot% + 16 THEN
  1814.                          IF xMouse% > xHot% AND xMouse% < xHot% + 48 THEN
  1815.                             Ky% = 13
  1816.                          END IF
  1817.                       END IF
  1818.                       DO
  1819.                           MouseNow LeftButton%, RightButton%, xMouse%, yMouse%
  1820.                       LOOP WHILE LeftButton%
  1821.                    END IF
  1822.                 END IF
  1823.              LOOP UNTIL Ky% = 13
  1824.              IF Mouse% THEN MouseHide
  1825.              ShutUp -1
  1826.         CASE ELSE
  1827.     END SELECT
  1828. GOTO D002
  1829.  
  1830. '   Program Exit
  1831. '
  1832. D810:
  1833.     IF Colour% THEN
  1834.        Scroll 1, 1, 1, 25, 80, 0, Attribute%(15, 1)
  1835.        COLOR , , 1: Attrib% = 32
  1836.     ELSE
  1837.        FOR I% = 1 TO 24
  1838.            FastPrint I%, 1, STRING$(80, "░"), 7
  1839.        NEXT I%
  1840.        Attrib% = 112
  1841.     END IF
  1842.     PopUp 3, 2, 9, 44, Attrib%, 3, 2, -1: RESTORE Credits
  1843.     FOR I% = 4 TO 9
  1844.         READ Me$: FastPrint I%, 4, Me$, Attrib%
  1845.     NEXT I%
  1846.     SLEEP 5: KeyFlush
  1847.     IF Colour% THEN Attrib% = 48 ELSE Attrib% = 112
  1848.     PopUp 10, 29, 11, 50, Attrib%, 2, 1, -1
  1849.     FOR I% = 11 TO 19
  1850.         READ Me$: FastPrint I%, 31, Me$, Attrib%
  1851.     NEXT I%
  1852.     SLEEP 10: ShutUp -1: SLEEP 1: ShutUp -1: SLEEP 1
  1853.     CALL KeyFlush: CLS
  1854. GOTO Egress
  1855.  
  1856. '┌────────────────────────────────────────────────────────────────────────┐
  1857. '│      Operating System Shell.                                           │
  1858. '└────────────────────────────────────────────────────────────────────────┘
  1859. '
  1860. D820:
  1861.     FastPrint 21, 2, SPACE$(78), 31
  1862.     Me$ = "Enter the command 'EXIT' when you are ready to return."
  1863.     FastPrint 21, 40 - (LEN(Me$) \ 2), Me$, 31
  1864.     LOCATE 13, 1, 1: ON ERROR GOTO D821
  1865.     PopUp 5, 4, 15, 74, 15, 3, 0, -1
  1866.     DOSBox 1, 6, 5, 18, 75, 7
  1867.     SHELL
  1868.     DOSBox 0, 0, 0, 0, 0, 0
  1869.     LOCATE 3, 1, 0: ShutUp -1
  1870.     FastPrint 21, 2, SPACE$(78), TextColour%
  1871.     ON ERROR GOTO Trap
  1872.     GOTO D800
  1873. D821:
  1874.     ON ERROR GOTO Trap
  1875.     DOSBox 0, 0, 0, 0, 0, 0
  1876.     LOCATE 3, 1, 0: ShutUp -1
  1877.     FastPrint 21, 2, SPACE$(78), TextColour%
  1878.     IF ERR = 5 THEN
  1879.        MisTake 9, "Cannot load secondary Command Processor", 0, Mouse%
  1880.        RESUME D800
  1881.     END IF
  1882.  
  1883. '┌────────────────────────────────────────────────────────────────────────┐
  1884. '│      Error Trap.                                                       │
  1885. '└────────────────────────────────────────────────────────────────────────┘
  1886. '
  1887. Trap:
  1888.     Fatal% = TRUE
  1889.     SELECT CASE ERR
  1890.         CASE 7, 14
  1891.              Me$ = "Out of memory"
  1892.         CASE 27
  1893.              Me$ = "PRINTER NOT READY": Fatal% = FALSE
  1894.         CASE 61, 67
  1895.              Me$ = "Out of disk space"
  1896.         CASE 71
  1897.              Me$ = "DISK DRIVE NOT READY": Fatal% = FALSE
  1898.         CASE 72
  1899.              Me$ = "Disk media error"
  1900.         CASE ELSE
  1901.              A$ = STR$(ERR): Me$ = "A type" + A$ + " Error has just occurred"
  1902.     END SELECT
  1903.     IF Fatal% THEN
  1904.        Me$ = Me$ + ", aborting to DOS ..."
  1905.        SL% = StatusLine%(Me$)
  1906.        RESUME Egress
  1907.     ELSE
  1908.        ML% = LEN(Me$): MT% = 40 - (ML% \ 2)
  1909.        IF Colour% THEN Attrib% = 78 ELSE Attrib% = 112
  1910.        PopUp 9, 20, 7, 42, Attrib%, 3, 2, -1
  1911.        FastPrint 10, MT%, Me$, Attrib% + 128: BEEP
  1912.        Me$ = "Please correct this error if possible"
  1913.        FastPrint 12, 22, Me$, Attrib%
  1914.        FastPrint 13, 30, "Press a key when ready", Attrib%
  1915.        FastPrint 14, 32, "or <ESC> to Abort.", Attrib%
  1916.        Character% = KeyIn%: ShutUp -1
  1917.        IF Character% = 27 THEN RESUME Egress
  1918.        RESUME
  1919.     END IF
  1920. Egress:
  1921.     Attr% = SCREEN(20, 1, 1)
  1922.     Curtains 25, 255: Curtains 25, 31: Curtains 25, Attr%
  1923.     LOCATE 20, 1, 1: ClearEnd 1, Attr%
  1924. END
  1925.  
  1926. '┌────────────────────────────────────────────────────────────────────────┐
  1927. '│     Program specific functions and procedures.                         │
  1928. '└────────────────────────────────────────────────────────────────────────┘
  1929. '
  1930. '   Draws or refreshes the main display screen. If switch is zero, only the
  1931. '   status line is refreshed.
  1932. '
  1933. SUB Frame (Title$, Switch%) STATIC
  1934.     SHARED StatColour%, HeadColour%, TextColour%, ToDay$
  1935.     IF Switch% THEN
  1936.        Scroll 1, 1, 1, 3, 80, 0, HeadColour%
  1937.        IF Title$ <> "" THEN
  1938.           FastPrint 1, 40 - (LEN(Title$) \ 2), Title$, HeadColour%
  1939.        END IF
  1940.        FastPrint 2, 1, STRING$(80, "─"), HeadColour%
  1941.        Panel 4, 1, 21, 80, 1, TextColour%
  1942.     END IF
  1943.     FastPrint 25, 1, SPACE$(80), StatColour%
  1944.     FastPrint 25, 4, "Press <F1> for Help, <ESC> to Abort", StatColour%
  1945.     IF ToDay$ <> "" THEN
  1946.        FastPrint 25, 78 - LEN(ToDay$), ToDay$, StatColour%
  1947.     END IF
  1948. END SUB
  1949.  
  1950. '┌────────────────────────────────────────────────────────────────────────┐
  1951. '│     Data Division.                                                     │
  1952. '└────────────────────────────────────────────────────────────────────────┘
  1953. '
  1954. Blurb:
  1955.     DATA "The Library modules on this disk provide you"
  1956.     DATA "with all the facilities necessary for you to"
  1957.     DATA "implement a full range of window features in"
  1958.     DATA "your programs.  With just one statement, for"
  1959.     DATA "instance, you can 'Pop-up' a window onto the"
  1960.     DATA "screen."
  1961.     DATA "The window can be a simple rectangle, in any"
  1962.     DATA "the QuickBASIC background colors, such as .."
  1963.     DATA "Alternatively it may have a border in one of"
  1964.     DATA "eight styles ...."
  1965.     DATA "The border itself may be in any one of the"
  1966.     DATA "QuickBASIC foreground colors. It can blink"
  1967.     DATA "if you want it to ..."
  1968.     DATA "The window, too, can be presented in several"
  1969.     DATA "different ways. It can be flat..."
  1970.     DATA "or it can have a black shadow underneath, to"
  1971.     DATA "give a three-dimensional effect..."
  1972.     DATA "Once you have a window on the screen, simply"
  1973.     DATA "use FASTPRINT, also in the TOOLBOX Library, "
  1974.     DATA "to put text into it, in any colour you like."
  1975.     DATA "You can also use the SCROLL routine from the"
  1976.     DATA "same source, to clear the window's contents."
  1977.     DATA "All the functions in the Library are written"
  1978.     DATA "in fast assembly language, but this does not"
  1979.     DATA "prevent them from being very easy to use."
  1980.     DATA "This for instance, is the call to create the"
  1981.     DATA "present window ....."
  1982.     DATA "   PopUp 8, 14, 8, 52, 112, 2, 0, -1"
  1983.     DATA "Before opening a window, the function stores"
  1984.     DATA "the screen beneath it in an internal buffer."
  1985.     DATA "When you close a window, the screen contents"
  1986.     DATA "are restored to their original location. Use"
  1987.     DATA "the statement 'ShutUp -1' to close the last"
  1988.     DATA "window opened.  For example ...."
  1989.     DATA "The Library includes several functions which"
  1990.     DATA "apply windowing techniques. The HELP screen,"
  1991.     DATA "which is available at the front menu, is one"
  1992.     DATA "example. Another is the VERIFY BOX which you"
  1993.     DATA "can use to collect a Yes/No response from an"
  1994.     DATA "operator, without redrawing the display."
  1995.     DATA "Another utility is the STATUS LINE MESSAGE,"
  1996.     DATA "which can be used to pause execution of the"
  1997.     DATA "program until the operator presses a key."
  1998.     DATA "You can display any prompt message you like"
  1999.     DATA "and the function will return the ASCII code"
  2000.     DATA "of the key which was pressed."
  2001.     DATA "I often use StatusLine in conjunction with a"
  2002.     DATA "routine which checks if the printer is ready"
  2003.     DATA "or not.  This gives the user a chance to fix"
  2004.     DATA "the printer,  if it is just out of paper, or"
  2005.     DATA "to abandon printing, if it is a more serious"
  2006.     DATA "problem. PrinTest is included here too."
  2007.  
  2008. Flags:
  2009.     DATA "The ASSEMBLY-LANGUAGE TOOLBOX includes a"
  2010.     DATA "pair  of functions which give you access"
  2011.     DATA "to  the  INTRA-APPLICATION COMMUNICATION"
  2012.     DATA "AREA (IAC),  an area of memory which has"
  2013.     DATA "been reserved,  by DOS, so that programs"
  2014.     DATA "can communicate with each other. The IAC"
  2015.     DATA "is 16 bytes long and is located,  in low"
  2016.     DATA "RAM at addresses 0000:04F0 - 04FF (Hex)."
  2017.     DATA "Once set, an IAC flag retains it's value"
  2018.     DATA "until  you reset it,  or the computer is"
  2019.     DATA "rebooted."
  2020.     DATA "Since QuickBASIC programs, compiled with"
  2021.     DATA "the /O switch to run stand-alone, cannot"
  2022.     DATA "pass variables to chain modules, you can"
  2023.     DATA "use  this feature to implement a limited"
  2024.     DATA "form of parameter passing."
  2025.     DATA "1.4F0h       9.4F8h", "2.4F1h      10.4F9h"
  2026.     DATA "3.4F2h      11.4FAh", "4.4F3h      12.4FBh"
  2027.     DATA "5.4F4h      13.4FCh", "6.4F5h      14.4FDh"
  2028.     DATA "7.4F6h      15.4FEh", "8.4F7h      16.4FFh"
  2029.     DATA 10, 59, 11, 59, 12, 59, 13, 59, 14, 59, 15, 59
  2030.     DATA 16, 59, 17, 59, 10, 72, 11, 72, 12, 72, 13, 72
  2031.     DATA 14, 72, 15, 72, 16, 72, 17, 72
  2032.  
  2033. Finder:
  2034.     DATA "This function allows you to find out if a particular"
  2035.     DATA "file is present on any disk drive in the system."," "
  2036.     DATA "Enter the name of the file which you want to locate,"
  2037.     DATA "including the drive letter and directory pathname if"
  2038.     DATA "required.  You can use an ambiguous name,  including"
  2039.     DATA "the wildcard characters (* and ?).  In this case the"
  2040.     DATA "function will pop up a directory window containing a"
  2041.     DATA "list of all files that match. You can select the one"
  2042.     DATA "you are interested in,  by high-lighting it with the"
  2043.     DATA "cursor arrow keys and pressing <RETURN>. The routine"
  2044.     DATA "returns a string containing the full pathname of the"
  2045.     DATA "file which you have selected."
  2046.  
  2047. Sorts:
  2048.     DATA "SORTFILE sorts ASCII text files. You supply the name, which may"
  2049.     DATA "include a directory pathname, and the start position and length"
  2050.     DATA "of the field which the file is to be sorted on.", " "
  2051.     DATA "The program first checks the size of the file and the amount of"
  2052.     DATA "free disk space to see if the it can be sorted in memory, this"
  2053.     DATA "requires space for two copies of the file on disk. If it is too"
  2054.     DATA "large, the file is sorted in place so that no extra disk space"
  2055.     DATA "is required. Using this method, which is far slower, the file"
  2056.     DATA "may be of any size up to 4 Gigabytes."
  2057.  
  2058. Size:
  2059.     DATA "THIS PROGRAM REPORTS THE SIZE OF FILES WHICH YOU SPECIFY"
  2060.     DATA "--------------------------------------------------------", " "
  2061.     DATA "The filename can include a directory path and may be ambiguous,"
  2062.     DATA "using the wildcard characters '*' and '?'. The program will"
  2063.     DATA "return the size of the file, in bytes, or, if more than one"
  2064.     DATA "match is found, the total size of all the files. If a size of"
  2065.     DATA "zero is returned, the file does not exist (at least not in the"
  2066.     DATA "directory specified).", " "
  2067.     DATA "Type in the pathname required (no more than 64 characters) or"
  2068.     DATA "Enter an empty string to quit."
  2069.  
  2070. KeyBuff:
  2071.     DATA 19, 6, 4, "Head Tail", 6, 33, "Keyboard Buffer"
  2072.     DATA  6, 67, "Buffer Area", 8, 4, "041A 041C"
  2073.     DATA  8, 17, "1E 20 22 24 26 28 2A 2C 2E 30 32 34 36 38 3A 3C"
  2074.     DATA  8, 68, "0480 0482", 10, 3, "┌────┬────┐"
  2075.     DATA 10, 16, "┌──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┬──┐"
  2076.     DATA 10, 67, "┌────┬────┐",11, 3,"│         │", 11, 16, "│"
  2077.     DATA 11, 64, "│", 11, 67, "│         │", 12, 3, "└────┴────┘"
  2078.     DATA 12, 16, "└──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┴──┘"
  2079.     DATA 12, 67, "└────┴────┘", 14, 3, "ASCII Codes"
  2080.     DATA 14, 67, "Waiting", 15, 3, "Scan Codes"
  2081.  
  2082. HWare:
  2083.     DATA "Unknown computer type", "PC", "PC/XT", "PCjr"
  2084.     DATA "PC/AT, PS/2 Model 50/60", "PC/XT", "PS/2 Model 30"
  2085.     DATA "PC Convertible", "PS/2 Model 80"
  2086.  
  2087. Shift:
  2088.     DATA "Left & Right SHIFT keys pressed", "CTRL key pressed"
  2089.     DATA "ALT key pressed", "SCROLL LOCK active"
  2090.     DATA "NUM LOCK active", "CAPS LOCK active"
  2091.     DATA "INSERT key status", "Left CTRL key pressed"
  2092.     DATA "Left ALT key pressed", "SYS REQ key pressed"
  2093.     DATA "PAUSE (or CTRL-NUM LOCK) active", "SCROLL LOCK pressed"
  2094.     DATA "NUM LOCK pressed", "CAPS LOCK pressed"
  2095.     DATA "INSERT key pressed"
  2096.  
  2097. Numbers:
  2098.     DATA 8, 1, 125678, 125678, 158, 158, 158, 158, 123458, 123458
  2099.     DATA 8, 4, 1278, 1278, 18, 148, 148, 148, F, 1235678
  2100.     DATA 8, 5, 12345, 12345, 5, 5, 45678, 45678, 5, 5
  2101.     DATA 8, 6, 12348, 12348, 148, 148, 148, 148, 145678, 145678
  2102.  
  2103. Crypt:
  2104.     DATA "This routine requires that you supply two strings of
  2105.     DATA "characters. The first is the text to be encrypted, and"
  2106.     DATA "the second is one or more keywords which are used to"
  2107.     DATA "encipher the text. Thereafter, the text cannot be"
  2108.     DATA "decrypted until you supply the same key string again."
  2109.  
  2110. Strings:
  2111.     DATA "Building a 1000 element, variable-length, string array"
  2112.     DATA "in memory and filling it with random data .... "
  2113.     DATA "Sort into Ascending or Descending order (A/D) [ ]"
  2114.  
  2115. Path:
  2116.     DATA "By default, the Toolbox Help system looks for its'"
  2117.     DATA "topic files in a subdirectory called HELP, beneath"
  2118.     DATA "the currently-logged directory.  You can, however,"
  2119.     DATA "direct it to look elsewhere for files by setting a"
  2120.     DATA "HELP variable in the DOS environment table;",""
  2121.     DATA "e.g.  SET HELP=C:\BASIC\TOOLBOX\HELP",""
  2122.     DATA "Alternatively, you can use the QuickBASIC ENVIRON"
  2123.     DATA "statement within your program, to point HELPMATE to"
  2124.     DATA "the appropriate pathname. Remember, 'though, that"
  2125.     DATA "this method only remains in effect as long as the"
  2126.     DATA "current program is running."
  2127.     DATA "The current HELP environment pathname is"
  2128.     DATA "Enter replacement or press <Esc> to leave unchanged"
  2129.  
  2130. Title:
  2131.     DATA 1, 2, 2, 2, 29, 0, 92, 23, 95
  2132.     DATA 64, 98, 104, 101, 135, 103, 102, 106, 65, 112, 30, 115
  2133.     DATA 10, 119, 5, 122, 3, 125, 5, 128, 10, 131, 30, 136, 65, 142
  2134.     DATA 221, 165, 320, 165, 320, 156, 35, 125, 27, 122, 35, 119
  2135.     DATA 65, 112, 102, 106, 135, 103, 149, 102, 162, 101, 195, 98
  2136.     DATA 240, 92, 272, 90, 304, 92, 320, 94
  2137.     DATA 0, 6, 6, 167, 8, 320, 94, 304, 92
  2138.     DATA 272, 90, 240, 92, 195, 98, 162, 101, 149, 102, 135, 103
  2139.     DATA 102, 106, 82, 109
  2140.     DATA 3, 7, 7, 90, 6, 220, 85, 220, 98
  2141.     DATA 300, 98, 300, 86, 305, 86, 260, 73, 215, 86, 220, 86
  2142.     DATA 0, 6, 6, 167
  2143.  
  2144.     DATA 6
  2145.     DATA 15, 65, "Toolbox Users", 15, -1, 1
  2146.     DATA 15, 75, "register now at...", 15, -1, 1
  2147.     DATA 15, 95, "Club-PC BBS", 15, -1, 1
  2148.     DATA 15, 105, "1217 Crescent Drive", 15, -1, 1
  2149.     DATA 15, 115, "Smithfield VA 23430", 15, -1, 1
  2150.     DATA 15, 134, "Tel. (804) 357-0357", 15, -1, 1
  2151.     DATA 2
  2152.     DATA 8, 172, "for TOOLBOX support", 14, 0, 2
  2153.     DATA 8, 172, "    TOOLBOX", 13, -1, 2
  2154.     DATA 2
  2155.     DATA 39, 192, "Press the SPACE BAR to continue", 11, 0, 1
  2156.     DATA 39, 192, "          SPACE BAR", 15, -1, 1
  2157.  
  2158. Escher:
  2159.     DATA 68,4,200,76,52,12,112,44,128,52,172,76,128,52,68,84,112,44,84,60
  2160.     DATA 128,68,99,84,68,36,97,52,128,68,154,84,128,68,128,116,128,52,128
  2161.     DATA 68,68,4,52,12,172,76,142,90,142,76,142,108,142,108,200,76,200,76
  2162.     DATA 200,92,200,92,68,164,128,116,84,140,52,12,52,154,52,154,68,164
  2163.     DATA 68,164,68,100,68,36,68,84,84,45,84,76,84,109,84,140,68,100,97,116
  2164.     DATA 84,124,112,108,68,84,128,116,84,76,112,92,112,77,112,108,84,119
  2165.     DATA 92,114,142,86,151,82,180,66,186,62,186,62,236,90,236,90,68,184
  2166.     DATA 68,184,16,154,16,154,52,133,16,154,16,160,16,160,68,190,68,190
  2167.     DATA 68,184,68,190,236,96,236,96,236,90
  2168.  
  2169. About:
  2170.     DATA "Assembly-Language Toolbox demonstration program"
  2171.     DATA "(c)1988 Christy Gemmell and Singular Software"
  2172.     DATA "Release 5.50 - October 1992"
  2173.  
  2174. Credits:
  2175.     DATA "   The Assembly-Language Toolbox for   "
  2176.     DATA "          Microsoft QuickBASIC         "
  2177.     DATA "    Professional Edition, Release 5    "
  2178.     DATA "                                       "
  2179.     DATA " is also available for BASIC 7 PDS and "
  2180.     DATA "          Visual BASIC for DOS         "
  2181.  
  2182.     DATA "The Professional Edition contains source code,"
  2183.     DATA "object files, stand-alone and Quick libraries"
  2184.     DATA "and a complete set of documentation. To order"
  2185.     DATA "To order, contact:    James J. Kreyling"
  2186.     DATA "                      CPC Consulting Company"
  2187.     DATA "                      1217 Crescent Drive,"
  2188.     DATA "                      Smithfield  VA 23430"
  2189.     DATA "        or through... Club-PC BBS (8-N-1)"
  2190.     DATA "Tel (804) 357-9190    BBS (804) 357-0357"
  2191.  
  2192. '┌────────────────────────────────────────────────────────────────────────┐
  2193. '│      (c) 1988,1992 By Christy Gemmell and Singular Software.           │
  2194. '└────────────────────────────────────────────────────────────────────────┘
  2195.